ChimeraTK-ControlSystemAdapter-OPCUAAdapter  01.06.00
open62541.c
Go to the documentation of this file.
1 /* THIS IS A SINGLE-FILE DISTRIBUTION CONCATENATED FROM THE OPEN62541 SOURCES
2  * visit http://open62541.org/ for information about this software
3  * Git-Revision: v0.2-57-g4da3b50
4  */
5 
6 /*
7  * Copyright (C) 2014-2016 the contributors as stated in the AUTHORS file
8  *
9  * This file is part of open62541. open62541 is free software: you can
10  * redistribute it and/or modify it under the terms of the Mozilla Public
11  * License v2.0 as stated in the LICENSE file provided with open62541.
12  *
13  * open62541 is distributed in the hope that it will be useful, but WITHOUT ANY
14  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  * A PARTICULAR PURPOSE.
16  */
17 
18 #ifndef UA_DYNAMIC_LINKING_EXPORT
19 # define UA_DYNAMIC_LINKING_EXPORT
20 #endif
21 
22 #include "open62541.h"
23 
24 /*********************************** amalgamated original file "/home/iosb/sw/open62541/deps/queue.h" ***********************************/
25 
26 /* $OpenBSD: queue.h,v 1.38 2013/07/03 15:05:21 fgsch Exp $ */
27 /* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */
28 
29 /*
30  * Copyright (c) 1991, 1993
31  * The Regents of the University of California. All rights reserved.
32  *
33  * Redistribution and use in source and binary forms, with or without
34  * modification, are permitted provided that the following conditions
35  * are met:
36  * 1. Redistributions of source code must retain the above copyright
37  * notice, this list of conditions and the following disclaimer.
38  * 2. Redistributions in binary form must reproduce the above copyright
39  * notice, this list of conditions and the following disclaimer in the
40  * documentation and/or other materials provided with the distribution.
41  * 3. Neither the name of the University nor the names of its contributors
42  * may be used to endorse or promote products derived from this software
43  * without specific prior written permission.
44  *
45  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
46  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48  * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
49  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55  * SUCH DAMAGE.
56  *
57  * @(#)queue.h 8.5 (Berkeley) 8/20/94
58  */
59 
60 #ifndef _SYS_QUEUE_H_
61 #define _SYS_QUEUE_H_
62 
63 /*
64  * This file defines five types of data structures: singly-linked lists,
65  * lists, simple queues, tail queues, and circular queues.
66  *
67  *
68  * A singly-linked list is headed by a single forward pointer. The elements
69  * are singly linked for minimum space and pointer manipulation overhead at
70  * the expense of O(n) removal for arbitrary elements. New elements can be
71  * added to the list after an existing element or at the head of the list.
72  * Elements being removed from the head of the list should use the explicit
73  * macro for this purpose for optimum efficiency. A singly-linked list may
74  * only be traversed in the forward direction. Singly-linked lists are ideal
75  * for applications with large datasets and few or no removals or for
76  * implementing a LIFO queue.
77  *
78  * A list is headed by a single forward pointer (or an array of forward
79  * pointers for a hash table header). The elements are doubly linked
80  * so that an arbitrary element can be removed without a need to
81  * traverse the list. New elements can be added to the list before
82  * or after an existing element or at the head of the list. A list
83  * may only be traversed in the forward direction.
84  *
85  * A simple queue is headed by a pair of pointers, one the head of the
86  * list and the other to the tail of the list. The elements are singly
87  * linked to save space, so elements can only be removed from the
88  * head of the list. New elements can be added to the list before or after
89  * an existing element, at the head of the list, or at the end of the
90  * list. A simple queue may only be traversed in the forward direction.
91  *
92  * A tail queue is headed by a pair of pointers, one to the head of the
93  * list and the other to the tail of the list. The elements are doubly
94  * linked so that an arbitrary element can be removed without a need to
95  * traverse the list. New elements can be added to the list before or
96  * after an existing element, at the head of the list, or at the end of
97  * the list. A tail queue may be traversed in either direction.
98  *
99  * A circle queue is headed by a pair of pointers, one to the head of the
100  * list and the other to the tail of the list. The elements are doubly
101  * linked so that an arbitrary element can be removed without a need to
102  * traverse the list. New elements can be added to the list before or after
103  * an existing element, at the head of the list, or at the end of the list.
104  * A circle queue may be traversed in either direction, but has a more
105  * complex end of list detection.
106  *
107  * For details on the use of these macros, see the queue(3) manual page.
108  */
109 
110 #if defined(QUEUE_MACRO_DEBUG) || (defined(_KERNEL) && defined(DIAGNOSTIC))
111 #define _Q_INVALIDATE(a) (a) = ((void *)-1)
112 #else
113 #define _Q_INVALIDATE(a)
114 #endif
115 
116 /*
117  * Singly-linked List definitions.
118  */
119 #define SLIST_HEAD(name, type) \
120 struct name { \
121  struct type *slh_first; /* first element */ \
122 }
123 
124 #define SLIST_HEAD_INITIALIZER(head) \
125  { NULL }
126 
127 /* Fix redefinition of SLIST_ENTRY on mingw winnt.h */
128 # ifdef SLIST_ENTRY
129 # undef SLIST_ENTRY
130 # endif
131 
132 #define SLIST_ENTRY(type) \
133 struct { \
134  struct type *sle_next; /* next element */ \
135 }
136 
137 /*
138  * Singly-linked List access methods.
139  */
140 #define SLIST_FIRST(head) ((head)->slh_first)
141 #define SLIST_END(head) NULL
142 #define SLIST_EMPTY(head) (SLIST_FIRST(head) == SLIST_END(head))
143 #define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
144 
145 #define SLIST_FOREACH(var, head, field) \
146  for((var) = SLIST_FIRST(head); \
147  (var) != SLIST_END(head); \
148  (var) = SLIST_NEXT(var, field))
149 
150 #define SLIST_FOREACH_SAFE(var, head, field, tvar) \
151  for ((var) = SLIST_FIRST(head); \
152  (var) && ((tvar) = SLIST_NEXT(var, field), 1); \
153  (var) = (tvar))
154 
155 /*
156  * Singly-linked List functions.
157  */
158 #define SLIST_INIT(head) { \
159  SLIST_FIRST(head) = SLIST_END(head); \
160 }
161 
162 #define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
163  (elm)->field.sle_next = (slistelm)->field.sle_next; \
164  (slistelm)->field.sle_next = (elm); \
165 } while (0)
166 
167 #define SLIST_INSERT_HEAD(head, elm, field) do { \
168  (elm)->field.sle_next = (head)->slh_first; \
169  (head)->slh_first = (elm); \
170 } while (0)
171 
172 #define SLIST_REMOVE_AFTER(elm, field) do { \
173  (elm)->field.sle_next = (elm)->field.sle_next->field.sle_next; \
174 } while (0)
175 
176 #define SLIST_REMOVE_HEAD(head, field) do { \
177  (head)->slh_first = (head)->slh_first->field.sle_next; \
178 } while (0)
179 
180 #define SLIST_REMOVE(head, elm, type, field) do { \
181  if ((head)->slh_first == (elm)) { \
182  SLIST_REMOVE_HEAD((head), field); \
183  } else { \
184  struct type *curelm = (head)->slh_first; \
185  \
186  while (curelm->field.sle_next != (elm)) \
187  curelm = curelm->field.sle_next; \
188  curelm->field.sle_next = \
189  curelm->field.sle_next->field.sle_next; \
190  _Q_INVALIDATE((elm)->field.sle_next); \
191  } \
192 } while (0)
193 
194 /*
195  * List definitions.
196  */
197 #define LIST_HEAD(name, type) \
198 struct name { \
199  struct type *lh_first; /* first element */ \
200 }
201 
202 #define LIST_HEAD_INITIALIZER(head) \
203  { NULL }
204 
205 #define LIST_ENTRY(type) \
206 struct { \
207  struct type *le_next; /* next element */ \
208  struct type **le_prev; /* address of previous next element */ \
209 }
210 
211 /*
212  * List access methods
213  */
214 #define LIST_FIRST(head) ((head)->lh_first)
215 #define LIST_END(head) NULL
216 #define LIST_EMPTY(head) (LIST_FIRST(head) == LIST_END(head))
217 #define LIST_NEXT(elm, field) ((elm)->field.le_next)
218 
219 #define LIST_FOREACH(var, head, field) \
220  for((var) = LIST_FIRST(head); \
221  (var)!= LIST_END(head); \
222  (var) = LIST_NEXT(var, field))
223 
224 #define LIST_FOREACH_SAFE(var, head, field, tvar) \
225  for ((var) = LIST_FIRST(head); \
226  (var) && ((tvar) = LIST_NEXT(var, field), 1); \
227  (var) = (tvar))
228 
229 /*
230  * List functions.
231  */
232 #define LIST_INIT(head) do { \
233  LIST_FIRST(head) = LIST_END(head); \
234 } while (0)
235 
236 #define LIST_INSERT_AFTER(listelm, elm, field) do { \
237  if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \
238  (listelm)->field.le_next->field.le_prev = \
239  &(elm)->field.le_next; \
240  (listelm)->field.le_next = (elm); \
241  (elm)->field.le_prev = &(listelm)->field.le_next; \
242 } while (0)
243 
244 #define LIST_INSERT_BEFORE(listelm, elm, field) do { \
245  (elm)->field.le_prev = (listelm)->field.le_prev; \
246  (elm)->field.le_next = (listelm); \
247  *(listelm)->field.le_prev = (elm); \
248  (listelm)->field.le_prev = &(elm)->field.le_next; \
249 } while (0)
250 
251 #define LIST_INSERT_HEAD(head, elm, field) do { \
252  if (((elm)->field.le_next = (head)->lh_first) != NULL) \
253  (head)->lh_first->field.le_prev = &(elm)->field.le_next;\
254  (head)->lh_first = (elm); \
255  (elm)->field.le_prev = &(head)->lh_first; \
256 } while (0)
257 
258 #define LIST_REMOVE(elm, field) do { \
259  if ((elm)->field.le_next != NULL) \
260  (elm)->field.le_next->field.le_prev = \
261  (elm)->field.le_prev; \
262  *(elm)->field.le_prev = (elm)->field.le_next; \
263  _Q_INVALIDATE((elm)->field.le_prev); \
264  _Q_INVALIDATE((elm)->field.le_next); \
265 } while (0)
266 
267 #define LIST_REPLACE(elm, elm2, field) do { \
268  if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \
269  (elm2)->field.le_next->field.le_prev = \
270  &(elm2)->field.le_next; \
271  (elm2)->field.le_prev = (elm)->field.le_prev; \
272  *(elm2)->field.le_prev = (elm2); \
273  _Q_INVALIDATE((elm)->field.le_prev); \
274  _Q_INVALIDATE((elm)->field.le_next); \
275 } while (0)
276 
277 /*
278  * Simple queue definitions.
279  */
280 #define SIMPLEQ_HEAD(name, type) \
281 struct name { \
282  struct type *sqh_first; /* first element */ \
283  struct type **sqh_last; /* addr of last next element */ \
284 }
285 
286 #define SIMPLEQ_HEAD_INITIALIZER(head) \
287  { NULL, &(head).sqh_first }
288 
289 #define SIMPLEQ_ENTRY(type) \
290 struct { \
291  struct type *sqe_next; /* next element */ \
292 }
293 
294 /*
295  * Simple queue access methods.
296  */
297 #define SIMPLEQ_FIRST(head) ((head)->sqh_first)
298 #define SIMPLEQ_END(head) NULL
299 #define SIMPLEQ_EMPTY(head) (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head))
300 #define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next)
301 
302 #define SIMPLEQ_FOREACH(var, head, field) \
303  for((var) = SIMPLEQ_FIRST(head); \
304  (var) != SIMPLEQ_END(head); \
305  (var) = SIMPLEQ_NEXT(var, field))
306 
307 #define SIMPLEQ_FOREACH_SAFE(var, head, field, tvar) \
308  for ((var) = SIMPLEQ_FIRST(head); \
309  (var) && ((tvar) = SIMPLEQ_NEXT(var, field), 1); \
310  (var) = (tvar))
311 
312 /*
313  * Simple queue functions.
314  */
315 #define SIMPLEQ_INIT(head) do { \
316  (head)->sqh_first = NULL; \
317  (head)->sqh_last = &(head)->sqh_first; \
318 } while (0)
319 
320 #define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \
321  if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
322  (head)->sqh_last = &(elm)->field.sqe_next; \
323  (head)->sqh_first = (elm); \
324 } while (0)
325 
326 #define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \
327  (elm)->field.sqe_next = NULL; \
328  *(head)->sqh_last = (elm); \
329  (head)->sqh_last = &(elm)->field.sqe_next; \
330 } while (0)
331 
332 #define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
333  if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
334  (head)->sqh_last = &(elm)->field.sqe_next; \
335  (listelm)->field.sqe_next = (elm); \
336 } while (0)
337 
338 #define SIMPLEQ_REMOVE_HEAD(head, field) do { \
339  if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
340  (head)->sqh_last = &(head)->sqh_first; \
341 } while (0)
342 
343 #define SIMPLEQ_REMOVE_AFTER(head, elm, field) do { \
344  if (((elm)->field.sqe_next = (elm)->field.sqe_next->field.sqe_next) \
345  == NULL) \
346  (head)->sqh_last = &(elm)->field.sqe_next; \
347 } while (0)
348 
349 /*
350  * XOR Simple queue definitions.
351  */
352 #define XSIMPLEQ_HEAD(name, type) \
353 struct name { \
354  struct type *sqx_first; /* first element */ \
355  struct type **sqx_last; /* addr of last next element */ \
356  unsigned long sqx_cookie; \
357 }
358 
359 #define XSIMPLEQ_ENTRY(type) \
360 struct { \
361  struct type *sqx_next; /* next element */ \
362 }
363 
364 /*
365  * XOR Simple queue access methods.
366  */
367 #define XSIMPLEQ_XOR(head, ptr) ((__typeof(ptr))((head)->sqx_cookie ^ \
368  (unsigned long)(ptr)))
369 #define XSIMPLEQ_FIRST(head) XSIMPLEQ_XOR(head, ((head)->sqx_first))
370 #define XSIMPLEQ_END(head) NULL
371 #define XSIMPLEQ_EMPTY(head) (XSIMPLEQ_FIRST(head) == XSIMPLEQ_END(head))
372 #define XSIMPLEQ_NEXT(head, elm, field) XSIMPLEQ_XOR(head, ((elm)->field.sqx_next))
373 
374 
375 #define XSIMPLEQ_FOREACH(var, head, field) \
376  for ((var) = XSIMPLEQ_FIRST(head); \
377  (var) != XSIMPLEQ_END(head); \
378  (var) = XSIMPLEQ_NEXT(head, var, field))
379 
380 #define XSIMPLEQ_FOREACH_SAFE(var, head, field, tvar) \
381  for ((var) = XSIMPLEQ_FIRST(head); \
382  (var) && ((tvar) = XSIMPLEQ_NEXT(head, var, field), 1); \
383  (var) = (tvar))
384 
385 /*
386  * XOR Simple queue functions.
387  */
388 #define XSIMPLEQ_INIT(head) do { \
389  arc4random_buf(&(head)->sqx_cookie, sizeof((head)->sqx_cookie)); \
390  (head)->sqx_first = XSIMPLEQ_XOR(head, NULL); \
391  (head)->sqx_last = XSIMPLEQ_XOR(head, &(head)->sqx_first); \
392 } while (0)
393 
394 #define XSIMPLEQ_INSERT_HEAD(head, elm, field) do { \
395  if (((elm)->field.sqx_next = (head)->sqx_first) == \
396  XSIMPLEQ_XOR(head, NULL)) \
397  (head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
398  (head)->sqx_first = XSIMPLEQ_XOR(head, (elm)); \
399 } while (0)
400 
401 #define XSIMPLEQ_INSERT_TAIL(head, elm, field) do { \
402  (elm)->field.sqx_next = XSIMPLEQ_XOR(head, NULL); \
403  *(XSIMPLEQ_XOR(head, (head)->sqx_last)) = XSIMPLEQ_XOR(head, (elm)); \
404  (head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
405 } while (0)
406 
407 #define XSIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
408  if (((elm)->field.sqx_next = (listelm)->field.sqx_next) == \
409  XSIMPLEQ_XOR(head, NULL)) \
410  (head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
411  (listelm)->field.sqx_next = XSIMPLEQ_XOR(head, (elm)); \
412 } while (0)
413 
414 #define XSIMPLEQ_REMOVE_HEAD(head, field) do { \
415  if (((head)->sqx_first = XSIMPLEQ_XOR(head, \
416  (head)->sqx_first)->field.sqx_next) == XSIMPLEQ_XOR(head, NULL)) \
417  (head)->sqx_last = XSIMPLEQ_XOR(head, &(head)->sqx_first); \
418 } while (0)
419 
420 #define XSIMPLEQ_REMOVE_AFTER(head, elm, field) do { \
421  if (((elm)->field.sqx_next = XSIMPLEQ_XOR(head, \
422  (elm)->field.sqx_next)->field.sqx_next) \
423  == XSIMPLEQ_XOR(head, NULL)) \
424  (head)->sqx_last = \
425  XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
426 } while (0)
427 
428 
429 /*
430  * Tail queue definitions.
431  */
432 #define TAILQ_HEAD(name, type) \
433 struct name { \
434  struct type *tqh_first; /* first element */ \
435  struct type **tqh_last; /* addr of last next element */ \
436 }
437 
438 #define TAILQ_HEAD_INITIALIZER(head) \
439  { NULL, &(head).tqh_first }
440 
441 #define TAILQ_ENTRY(type) \
442 struct { \
443  struct type *tqe_next; /* next element */ \
444  struct type **tqe_prev; /* address of previous next element */ \
445 }
446 
447 /*
448  * tail queue access methods
449  */
450 #define TAILQ_FIRST(head) ((head)->tqh_first)
451 #define TAILQ_END(head) NULL
452 #define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
453 #define TAILQ_LAST(head, headname) \
454  (*(((struct headname *)((head)->tqh_last))->tqh_last))
455 /* XXX */
456 #define TAILQ_PREV(elm, headname, field) \
457  (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
458 #define TAILQ_EMPTY(head) \
459  (TAILQ_FIRST(head) == TAILQ_END(head))
460 
461 #define TAILQ_FOREACH(var, head, field) \
462  for((var) = TAILQ_FIRST(head); \
463  (var) != TAILQ_END(head); \
464  (var) = TAILQ_NEXT(var, field))
465 
466 #define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
467  for ((var) = TAILQ_FIRST(head); \
468  (var) != TAILQ_END(head) && \
469  ((tvar) = TAILQ_NEXT(var, field), 1); \
470  (var) = (tvar))
471 
472 
473 #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
474  for((var) = TAILQ_LAST(head, headname); \
475  (var) != TAILQ_END(head); \
476  (var) = TAILQ_PREV(var, headname, field))
477 
478 #define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
479  for ((var) = TAILQ_LAST(head, headname); \
480  (var) != TAILQ_END(head) && \
481  ((tvar) = TAILQ_PREV(var, headname, field), 1); \
482  (var) = (tvar))
483 
484 /*
485  * Tail queue functions.
486  */
487 #define TAILQ_INIT(head) do { \
488  (head)->tqh_first = NULL; \
489  (head)->tqh_last = &(head)->tqh_first; \
490 } while (0)
491 
492 #define TAILQ_INSERT_HEAD(head, elm, field) do { \
493  if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
494  (head)->tqh_first->field.tqe_prev = \
495  &(elm)->field.tqe_next; \
496  else \
497  (head)->tqh_last = &(elm)->field.tqe_next; \
498  (head)->tqh_first = (elm); \
499  (elm)->field.tqe_prev = &(head)->tqh_first; \
500 } while (0)
501 
502 #define TAILQ_INSERT_TAIL(head, elm, field) do { \
503  (elm)->field.tqe_next = NULL; \
504  (elm)->field.tqe_prev = (head)->tqh_last; \
505  *(head)->tqh_last = (elm); \
506  (head)->tqh_last = &(elm)->field.tqe_next; \
507 } while (0)
508 
509 #define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
510  if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
511  (elm)->field.tqe_next->field.tqe_prev = \
512  &(elm)->field.tqe_next; \
513  else \
514  (head)->tqh_last = &(elm)->field.tqe_next; \
515  (listelm)->field.tqe_next = (elm); \
516  (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
517 } while (0)
518 
519 #define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
520  (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
521  (elm)->field.tqe_next = (listelm); \
522  *(listelm)->field.tqe_prev = (elm); \
523  (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
524 } while (0)
525 
526 #define TAILQ_REMOVE(head, elm, field) do { \
527  if (((elm)->field.tqe_next) != NULL) \
528  (elm)->field.tqe_next->field.tqe_prev = \
529  (elm)->field.tqe_prev; \
530  else \
531  (head)->tqh_last = (elm)->field.tqe_prev; \
532  *(elm)->field.tqe_prev = (elm)->field.tqe_next; \
533  _Q_INVALIDATE((elm)->field.tqe_prev); \
534  _Q_INVALIDATE((elm)->field.tqe_next); \
535 } while (0)
536 
537 #define TAILQ_REPLACE(head, elm, elm2, field) do { \
538  if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL) \
539  (elm2)->field.tqe_next->field.tqe_prev = \
540  &(elm2)->field.tqe_next; \
541  else \
542  (head)->tqh_last = &(elm2)->field.tqe_next; \
543  (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \
544  *(elm2)->field.tqe_prev = (elm2); \
545  _Q_INVALIDATE((elm)->field.tqe_prev); \
546  _Q_INVALIDATE((elm)->field.tqe_next); \
547 } while (0)
548 
549 /*
550  * Circular queue definitions.
551  */
552 #define CIRCLEQ_HEAD(name, type) \
553 struct name { \
554  struct type *cqh_first; /* first element */ \
555  struct type *cqh_last; /* last element */ \
556 }
557 
558 #define CIRCLEQ_HEAD_INITIALIZER(head) \
559  { CIRCLEQ_END(&head), CIRCLEQ_END(&head) }
560 
561 #define CIRCLEQ_ENTRY(type) \
562 struct { \
563  struct type *cqe_next; /* next element */ \
564  struct type *cqe_prev; /* previous element */ \
565 }
566 
567 /*
568  * Circular queue access methods
569  */
570 #define CIRCLEQ_FIRST(head) ((head)->cqh_first)
571 #define CIRCLEQ_LAST(head) ((head)->cqh_last)
572 #define CIRCLEQ_END(head) ((void *)(head))
573 #define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
574 #define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
575 #define CIRCLEQ_EMPTY(head) \
576  (CIRCLEQ_FIRST(head) == CIRCLEQ_END(head))
577 
578 #define CIRCLEQ_FOREACH(var, head, field) \
579  for((var) = CIRCLEQ_FIRST(head); \
580  (var) != CIRCLEQ_END(head); \
581  (var) = CIRCLEQ_NEXT(var, field))
582 
583 #define CIRCLEQ_FOREACH_SAFE(var, head, field, tvar) \
584  for ((var) = CIRCLEQ_FIRST(head); \
585  (var) != CIRCLEQ_END(head) && \
586  ((tvar) = CIRCLEQ_NEXT(var, field), 1); \
587  (var) = (tvar))
588 
589 #define CIRCLEQ_FOREACH_REVERSE(var, head, field) \
590  for((var) = CIRCLEQ_LAST(head); \
591  (var) != CIRCLEQ_END(head); \
592  (var) = CIRCLEQ_PREV(var, field))
593 
594 #define CIRCLEQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
595  for ((var) = CIRCLEQ_LAST(head, headname); \
596  (var) != CIRCLEQ_END(head) && \
597  ((tvar) = CIRCLEQ_PREV(var, headname, field), 1); \
598  (var) = (tvar))
599 
600 /*
601  * Circular queue functions.
602  */
603 #define CIRCLEQ_INIT(head) do { \
604  (head)->cqh_first = CIRCLEQ_END(head); \
605  (head)->cqh_last = CIRCLEQ_END(head); \
606 } while (0)
607 
608 #define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
609  (elm)->field.cqe_next = (listelm)->field.cqe_next; \
610  (elm)->field.cqe_prev = (listelm); \
611  if ((listelm)->field.cqe_next == CIRCLEQ_END(head)) \
612  (head)->cqh_last = (elm); \
613  else \
614  (listelm)->field.cqe_next->field.cqe_prev = (elm); \
615  (listelm)->field.cqe_next = (elm); \
616 } while (0)
617 
618 #define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
619  (elm)->field.cqe_next = (listelm); \
620  (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
621  if ((listelm)->field.cqe_prev == CIRCLEQ_END(head)) \
622  (head)->cqh_first = (elm); \
623  else \
624  (listelm)->field.cqe_prev->field.cqe_next = (elm); \
625  (listelm)->field.cqe_prev = (elm); \
626 } while (0)
627 
628 #define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
629  (elm)->field.cqe_next = (head)->cqh_first; \
630  (elm)->field.cqe_prev = CIRCLEQ_END(head); \
631  if ((head)->cqh_last == CIRCLEQ_END(head)) \
632  (head)->cqh_last = (elm); \
633  else \
634  (head)->cqh_first->field.cqe_prev = (elm); \
635  (head)->cqh_first = (elm); \
636 } while (0)
637 
638 #define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
639  (elm)->field.cqe_next = CIRCLEQ_END(head); \
640  (elm)->field.cqe_prev = (head)->cqh_last; \
641  if ((head)->cqh_first == CIRCLEQ_END(head)) \
642  (head)->cqh_first = (elm); \
643  else \
644  (head)->cqh_last->field.cqe_next = (elm); \
645  (head)->cqh_last = (elm); \
646 } while (0)
647 
648 #define CIRCLEQ_REMOVE(head, elm, field) do { \
649  if ((elm)->field.cqe_next == CIRCLEQ_END(head)) \
650  (head)->cqh_last = (elm)->field.cqe_prev; \
651  else \
652  (elm)->field.cqe_next->field.cqe_prev = \
653  (elm)->field.cqe_prev; \
654  if ((elm)->field.cqe_prev == CIRCLEQ_END(head)) \
655  (head)->cqh_first = (elm)->field.cqe_next; \
656  else \
657  (elm)->field.cqe_prev->field.cqe_next = \
658  (elm)->field.cqe_next; \
659  _Q_INVALIDATE((elm)->field.cqe_prev); \
660  _Q_INVALIDATE((elm)->field.cqe_next); \
661 } while (0)
662 
663 #define CIRCLEQ_REPLACE(head, elm, elm2, field) do { \
664  if (((elm2)->field.cqe_next = (elm)->field.cqe_next) == \
665  CIRCLEQ_END(head)) \
666  (head)->cqh_last = (elm2); \
667  else \
668  (elm2)->field.cqe_next->field.cqe_prev = (elm2); \
669  if (((elm2)->field.cqe_prev = (elm)->field.cqe_prev) == \
670  CIRCLEQ_END(head)) \
671  (head)->cqh_first = (elm2); \
672  else \
673  (elm2)->field.cqe_prev->field.cqe_next = (elm2); \
674  _Q_INVALIDATE((elm)->field.cqe_prev); \
675  _Q_INVALIDATE((elm)->field.cqe_next); \
676 } while (0)
677 
678 #endif /* !_SYS_QUEUE_H_ */
679 
680 /*********************************** amalgamated original file "/home/iosb/sw/open62541/deps/pcg_basic.h" ***********************************/
681 
682 /*
683  * PCG Random Number Generation for C.
684  *
685  * Copyright 2014 Melissa O'Neill <oneill@pcg-random.org>
686  *
687  * Licensed under the Apache License, Version 2.0 (the "License");
688  * you may not use this file except in compliance with the License.
689  * You may obtain a copy of the License at
690  *
691  * http://www.apache.org/licenses/LICENSE-2.0
692  *
693  * Unless required by applicable law or agreed to in writing, software
694  * distributed under the License is distributed on an "AS IS" BASIS,
695  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
696  * See the License for the specific language governing permissions and
697  * limitations under the License.
698  *
699  * For additional information about the PCG random number generation scheme,
700  * including its license and other licensing options, visit
701  *
702  * http://www.pcg-random.org
703  */
704 
705 
706 
707 #if __cplusplus
708 extern "C" {
709 #endif
710 
711 typedef struct pcg_state_setseq_64 {
712  uint64_t state; // RNG state. All values are possible.
713  uint64_t inc; // Controls which RNG sequence (stream) is selected. Must *always* be odd.
715 
716 #define PCG32_INITIALIZER { 0x853c49e6748fea9bULL, 0xda3e39cb94b95bdbULL }
717 
718 void pcg32_srandom_r(pcg32_random_t* rng, uint64_t initial_state, uint64_t initseq);
719 uint32_t pcg32_random_r(pcg32_random_t* rng);
720 
721 #if __cplusplus
722 }
723 #endif
724 
725 
726 /*********************************** amalgamated original file "/home/iosb/sw/open62541/deps/libc_time.h" ***********************************/
727 
728 
729 #include <limits.h>
730 #include <time.h>
731 int __secs_to_tm(long long t, struct tm *tm);
732 
733 
734 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_util.h" ***********************************/
735 
736 /* This Source Code Form is subject to the terms of the Mozilla Public
737 * License, v. 2.0. If a copy of the MPL was not distributed with this
738 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
739 
740 
741 
742 /* Assert */
743 #include <assert.h>
744 #define UA_assert(ignore) assert(ignore)
745 
746 /* BSD Queue Macros */
747 
748 /* container_of */
749 #define container_of(ptr, type, member) \
750  (type *)((uintptr_t)ptr - offsetof(type,member))
751 
752 /* Thread-Local Storage
753  * --------------------
754  * Thread-local variables are always enabled. Also when the library is built
755  * with ``UA_ENABLE_MULTITHREADING`` disabled. Otherwise, if multiple clients
756  * run in separate threads, race conditions may occur via global variables in
757  * the encoding layer. */
758 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
759 # define UA_THREAD_LOCAL _Thread_local /* C11 */
760 #elif defined(__GNUC__)
761 # define UA_THREAD_LOCAL __thread /* GNU extension */
762 #elif defined(_MSC_VER)
763 # define UA_THREAD_LOCAL __declspec(thread) /* MSVC extension */
764 #else
765 # warning The compiler does not support thread-local variables
766 # define UA_THREAD_LOCAL
767 #endif
768 
769 /* Integer Shortnames
770  * ------------------
771  * These are not exposed on the public API, since many user-applications make
772  * the same definitions in their headers. */
773 typedef UA_Byte u8;
774 typedef UA_SByte i8;
775 typedef UA_UInt16 u16;
776 typedef UA_Int16 i16;
777 typedef UA_UInt32 u32;
778 typedef UA_Int32 i32;
779 typedef UA_UInt64 u64;
780 typedef UA_Int64 i64;
782 
783 /* Atomic Operations
784  * -----------------
785  * Atomic operations that synchronize across processor cores (for
786  * multithreading). Only the inline-functions defined next are used. Replace
787  * with architecture-specific operations if necessary. */
788 #ifndef UA_ENABLE_MULTITHREADING
789 # define UA_atomic_sync()
790 #else
791 # ifdef _MSC_VER /* Visual Studio */
792 # define UA_atomic_sync() _ReadWriteBarrier()
793 # else /* GCC/Clang */
794 # define UA_atomic_sync() __sync_synchronize()
795 # endif
796 #endif
797 
798 static UA_INLINE void *
799 UA_atomic_xchg(void * volatile * addr, void *newptr) {
800 #ifndef UA_ENABLE_MULTITHREADING
801  void *old = *addr;
802  *addr = newptr;
803  return old;
804 #else
805 # ifdef _MSC_VER /* Visual Studio */
806  return _InterlockedExchangePointer(addr, newptr);
807 # else /* GCC/Clang */
808  return __sync_lock_test_and_set(addr, newptr);
809 # endif
810 #endif
811 }
812 
813 static UA_INLINE void *
814 UA_atomic_cmpxchg(void * volatile * addr, void *expected, void *newptr) {
815 #ifndef UA_ENABLE_MULTITHREADING
816  void *old = *addr;
817  if(old == expected) {
818  *addr = newptr;
819  }
820  return old;
821 #else
822 # ifdef _MSC_VER /* Visual Studio */
823  return _InterlockedCompareExchangePointer(addr, expected, newptr);
824 # else /* GCC/Clang */
825  return __sync_val_compare_and_swap(addr, expected, newptr);
826 # endif
827 #endif
828 }
829 
830 static UA_INLINE uint32_t
831 UA_atomic_add(volatile uint32_t *addr, uint32_t increase) {
832 #ifndef UA_ENABLE_MULTITHREADING
833  *addr += increase;
834  return *addr;
835 #else
836 # ifdef _MSC_VER /* Visual Studio */
837  return _InterlockedExchangeAdd(addr, increase) + increase;
838 # else /* GCC/Clang */
839  return __sync_add_and_fetch(addr, increase);
840 # endif
841 #endif
842 }
843 
844 
845 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_types_encoding_binary.h" ***********************************/
846 
847 /* This Source Code Form is subject to the terms of the Mozilla Public
848 * License, v. 2.0. If a copy of the MPL was not distributed with this
849 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
850 
851 
852 
853 typedef UA_StatusCode (*UA_exchangeEncodeBuffer)(void *handle, UA_ByteString *buf, size_t offset);
854 
856 UA_encodeBinary(const void *src, const UA_DataType *type,
857  UA_exchangeEncodeBuffer exchangeCallback, void *exchangeHandle,
858  UA_ByteString *dst, size_t *offset) UA_FUNC_ATTR_WARN_UNUSED_RESULT;
859 
861 UA_decodeBinary(const UA_ByteString *src, size_t *offset, void *dst,
863 
864 size_t UA_calcSizeBinary(void *p, const UA_DataType *type);
865 
866 
867 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_types_generated_encoding_binary.h" ***********************************/
868 
869 /* Generated from Opc.Ua.Types.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
870  * on host iosb-VirtualBox by user iosb at 2018-08-29 05:32:08 */
871 
872 
873 /* Boolean */
875 UA_Boolean_encodeBinary(const UA_Boolean *src, UA_ByteString *dst, size_t *offset) {
876  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BOOLEAN], NULL, NULL, dst, offset);
877 }
879 UA_Boolean_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Boolean *dst) {
880  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BOOLEAN]);
881 }
882 
883 /* SByte */
885 UA_SByte_encodeBinary(const UA_SByte *src, UA_ByteString *dst, size_t *offset) {
886  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SBYTE], NULL, NULL, dst, offset);
887 }
889 UA_SByte_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SByte *dst) {
890  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SBYTE]);
891 }
892 
893 /* Byte */
895 UA_Byte_encodeBinary(const UA_Byte *src, UA_ByteString *dst, size_t *offset) {
896  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BYTE], NULL, NULL, dst, offset);
897 }
899 UA_Byte_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Byte *dst) {
900  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BYTE]);
901 }
902 
903 /* Int16 */
905 UA_Int16_encodeBinary(const UA_Int16 *src, UA_ByteString *dst, size_t *offset) {
906  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_INT16], NULL, NULL, dst, offset);
907 }
909 UA_Int16_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Int16 *dst) {
910  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_INT16]);
911 }
912 
913 /* UInt16 */
915 UA_UInt16_encodeBinary(const UA_UInt16 *src, UA_ByteString *dst, size_t *offset) {
916  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UINT16], NULL, NULL, dst, offset);
917 }
919 UA_UInt16_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UInt16 *dst) {
920  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UINT16]);
921 }
922 
923 /* Int32 */
925 UA_Int32_encodeBinary(const UA_Int32 *src, UA_ByteString *dst, size_t *offset) {
926  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_INT32], NULL, NULL, dst, offset);
927 }
929 UA_Int32_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Int32 *dst) {
930  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_INT32]);
931 }
932 
933 /* UInt32 */
935 UA_UInt32_encodeBinary(const UA_UInt32 *src, UA_ByteString *dst, size_t *offset) {
936  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UINT32], NULL, NULL, dst, offset);
937 }
939 UA_UInt32_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UInt32 *dst) {
940  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UINT32]);
941 }
942 
943 /* Int64 */
945 UA_Int64_encodeBinary(const UA_Int64 *src, UA_ByteString *dst, size_t *offset) {
946  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_INT64], NULL, NULL, dst, offset);
947 }
949 UA_Int64_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Int64 *dst) {
950  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_INT64]);
951 }
952 
953 /* UInt64 */
955 UA_UInt64_encodeBinary(const UA_UInt64 *src, UA_ByteString *dst, size_t *offset) {
956  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UINT64], NULL, NULL, dst, offset);
957 }
959 UA_UInt64_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UInt64 *dst) {
960  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UINT64]);
961 }
962 
963 /* Float */
965 UA_Float_encodeBinary(const UA_Float *src, UA_ByteString *dst, size_t *offset) {
966  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FLOAT], NULL, NULL, dst, offset);
967 }
969 UA_Float_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Float *dst) {
970  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FLOAT]);
971 }
972 
973 /* Double */
975 UA_Double_encodeBinary(const UA_Double *src, UA_ByteString *dst, size_t *offset) {
976  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DOUBLE], NULL, NULL, dst, offset);
977 }
979 UA_Double_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Double *dst) {
980  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DOUBLE]);
981 }
982 
983 /* String */
985 UA_String_encodeBinary(const UA_String *src, UA_ByteString *dst, size_t *offset) {
986  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_STRING], NULL, NULL, dst, offset);
987 }
989 UA_String_decodeBinary(const UA_ByteString *src, size_t *offset, UA_String *dst) {
990  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_STRING]);
991 }
992 
993 /* DateTime */
995 UA_DateTime_encodeBinary(const UA_DateTime *src, UA_ByteString *dst, size_t *offset) {
996  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATETIME], NULL, NULL, dst, offset);
997 }
999 UA_DateTime_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DateTime *dst) {
1000  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATETIME]);
1001 }
1002 
1003 /* Guid */
1004 static UA_INLINE UA_StatusCode
1005 UA_Guid_encodeBinary(const UA_Guid *src, UA_ByteString *dst, size_t *offset) {
1006  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_GUID], NULL, NULL, dst, offset);
1007 }
1008 static UA_INLINE UA_StatusCode
1009 UA_Guid_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Guid *dst) {
1010  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_GUID]);
1011 }
1012 
1013 /* ByteString */
1014 static UA_INLINE UA_StatusCode
1015 UA_ByteString_encodeBinary(const UA_ByteString *src, UA_ByteString *dst, size_t *offset) {
1016  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BYTESTRING], NULL, NULL, dst, offset);
1017 }
1018 static UA_INLINE UA_StatusCode
1019 UA_ByteString_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ByteString *dst) {
1020  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BYTESTRING]);
1021 }
1022 
1023 /* XmlElement */
1024 static UA_INLINE UA_StatusCode
1025 UA_XmlElement_encodeBinary(const UA_XmlElement *src, UA_ByteString *dst, size_t *offset) {
1026  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_XMLELEMENT], NULL, NULL, dst, offset);
1027 }
1028 static UA_INLINE UA_StatusCode
1029 UA_XmlElement_decodeBinary(const UA_ByteString *src, size_t *offset, UA_XmlElement *dst) {
1030  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_XMLELEMENT]);
1031 }
1032 
1033 /* NodeId */
1034 static UA_INLINE UA_StatusCode
1035 UA_NodeId_encodeBinary(const UA_NodeId *src, UA_ByteString *dst, size_t *offset) {
1036  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODEID], NULL, NULL, dst, offset);
1037 }
1038 static UA_INLINE UA_StatusCode
1039 UA_NodeId_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NodeId *dst) {
1040  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODEID]);
1041 }
1042 
1043 /* ExpandedNodeId */
1044 static UA_INLINE UA_StatusCode
1045 UA_ExpandedNodeId_encodeBinary(const UA_ExpandedNodeId *src, UA_ByteString *dst, size_t *offset) {
1046  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_EXPANDEDNODEID], NULL, NULL, dst, offset);
1047 }
1048 static UA_INLINE UA_StatusCode
1049 UA_ExpandedNodeId_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ExpandedNodeId *dst) {
1050  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_EXPANDEDNODEID]);
1051 }
1052 
1053 /* StatusCode */
1054 static UA_INLINE UA_StatusCode
1055 UA_StatusCode_encodeBinary(const UA_StatusCode *src, UA_ByteString *dst, size_t *offset) {
1056  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_STATUSCODE], NULL, NULL, dst, offset);
1057 }
1058 static UA_INLINE UA_StatusCode
1059 UA_StatusCode_decodeBinary(const UA_ByteString *src, size_t *offset, UA_StatusCode *dst) {
1060  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_STATUSCODE]);
1061 }
1062 
1063 /* QualifiedName */
1064 static UA_INLINE UA_StatusCode
1065 UA_QualifiedName_encodeBinary(const UA_QualifiedName *src, UA_ByteString *dst, size_t *offset) {
1066  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUALIFIEDNAME], NULL, NULL, dst, offset);
1067 }
1068 static UA_INLINE UA_StatusCode
1069 UA_QualifiedName_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QualifiedName *dst) {
1070  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUALIFIEDNAME]);
1071 }
1072 
1073 /* LocalizedText */
1074 static UA_INLINE UA_StatusCode
1075 UA_LocalizedText_encodeBinary(const UA_LocalizedText *src, UA_ByteString *dst, size_t *offset) {
1076  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], NULL, NULL, dst, offset);
1077 }
1078 static UA_INLINE UA_StatusCode
1079 UA_LocalizedText_decodeBinary(const UA_ByteString *src, size_t *offset, UA_LocalizedText *dst) {
1080  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
1081 }
1082 
1083 /* ExtensionObject */
1084 static UA_INLINE UA_StatusCode
1085 UA_ExtensionObject_encodeBinary(const UA_ExtensionObject *src, UA_ByteString *dst, size_t *offset) {
1086  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_EXTENSIONOBJECT], NULL, NULL, dst, offset);
1087 }
1088 static UA_INLINE UA_StatusCode
1089 UA_ExtensionObject_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ExtensionObject *dst) {
1090  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_EXTENSIONOBJECT]);
1091 }
1092 
1093 /* DataValue */
1094 static UA_INLINE UA_StatusCode
1095 UA_DataValue_encodeBinary(const UA_DataValue *src, UA_ByteString *dst, size_t *offset) {
1096  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATAVALUE], NULL, NULL, dst, offset);
1097 }
1098 static UA_INLINE UA_StatusCode
1099 UA_DataValue_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DataValue *dst) {
1100  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATAVALUE]);
1101 }
1102 
1103 /* Variant */
1104 static UA_INLINE UA_StatusCode
1105 UA_Variant_encodeBinary(const UA_Variant *src, UA_ByteString *dst, size_t *offset) {
1106  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VARIANT], NULL, NULL, dst, offset);
1107 }
1108 static UA_INLINE UA_StatusCode
1109 UA_Variant_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Variant *dst) {
1110  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VARIANT]);
1111 }
1112 
1113 /* DiagnosticInfo */
1114 static UA_INLINE UA_StatusCode
1115 UA_DiagnosticInfo_encodeBinary(const UA_DiagnosticInfo *src, UA_ByteString *dst, size_t *offset) {
1116  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DIAGNOSTICINFO], NULL, NULL, dst, offset);
1117 }
1118 static UA_INLINE UA_StatusCode
1119 UA_DiagnosticInfo_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DiagnosticInfo *dst) {
1120  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DIAGNOSTICINFO]);
1121 }
1122 
1123 /* SignedSoftwareCertificate */
1124 static UA_INLINE UA_StatusCode
1125 UA_SignedSoftwareCertificate_encodeBinary(const UA_SignedSoftwareCertificate *src, UA_ByteString *dst, size_t *offset) {
1127 }
1128 static UA_INLINE UA_StatusCode
1129 UA_SignedSoftwareCertificate_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SignedSoftwareCertificate *dst) {
1130  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SIGNEDSOFTWARECERTIFICATE]);
1131 }
1132 
1133 /* BrowsePathTarget */
1134 static UA_INLINE UA_StatusCode
1135 UA_BrowsePathTarget_encodeBinary(const UA_BrowsePathTarget *src, UA_ByteString *dst, size_t *offset) {
1136  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEPATHTARGET], NULL, NULL, dst, offset);
1137 }
1138 static UA_INLINE UA_StatusCode
1139 UA_BrowsePathTarget_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowsePathTarget *dst) {
1140  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEPATHTARGET]);
1141 }
1142 
1143 /* ViewAttributes */
1144 static UA_INLINE UA_StatusCode
1145 UA_ViewAttributes_encodeBinary(const UA_ViewAttributes *src, UA_ByteString *dst, size_t *offset) {
1146  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VIEWATTRIBUTES], NULL, NULL, dst, offset);
1147 }
1148 static UA_INLINE UA_StatusCode
1149 UA_ViewAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ViewAttributes *dst) {
1150  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VIEWATTRIBUTES]);
1151 }
1152 
1153 /* BrowseResultMask */
1154 static UA_INLINE UA_StatusCode
1155 UA_BrowseResultMask_encodeBinary(const UA_BrowseResultMask *src, UA_ByteString *dst, size_t *offset) {
1156  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSERESULTMASK], NULL, NULL, dst, offset);
1157 }
1158 static UA_INLINE UA_StatusCode
1159 UA_BrowseResultMask_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseResultMask *dst) {
1160  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSERESULTMASK]);
1161 }
1162 
1163 /* RequestHeader */
1164 static UA_INLINE UA_StatusCode
1165 UA_RequestHeader_encodeBinary(const UA_RequestHeader *src, UA_ByteString *dst, size_t *offset) {
1166  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REQUESTHEADER], NULL, NULL, dst, offset);
1167 }
1168 static UA_INLINE UA_StatusCode
1169 UA_RequestHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RequestHeader *dst) {
1170  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REQUESTHEADER]);
1171 }
1172 
1173 /* MonitoredItemModifyResult */
1174 static UA_INLINE UA_StatusCode
1175 UA_MonitoredItemModifyResult_encodeBinary(const UA_MonitoredItemModifyResult *src, UA_ByteString *dst, size_t *offset) {
1177 }
1178 static UA_INLINE UA_StatusCode
1179 UA_MonitoredItemModifyResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoredItemModifyResult *dst) {
1180  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMMODIFYRESULT]);
1181 }
1182 
1183 /* CloseSecureChannelRequest */
1184 static UA_INLINE UA_StatusCode
1185 UA_CloseSecureChannelRequest_encodeBinary(const UA_CloseSecureChannelRequest *src, UA_ByteString *dst, size_t *offset) {
1187 }
1188 static UA_INLINE UA_StatusCode
1189 UA_CloseSecureChannelRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CloseSecureChannelRequest *dst) {
1190  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CLOSESECURECHANNELREQUEST]);
1191 }
1192 
1193 /* AddNodesResult */
1194 static UA_INLINE UA_StatusCode
1195 UA_AddNodesResult_encodeBinary(const UA_AddNodesResult *src, UA_ByteString *dst, size_t *offset) {
1196  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDNODESRESULT], NULL, NULL, dst, offset);
1197 }
1198 static UA_INLINE UA_StatusCode
1199 UA_AddNodesResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddNodesResult *dst) {
1200  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDNODESRESULT]);
1201 }
1202 
1203 /* VariableAttributes */
1204 static UA_INLINE UA_StatusCode
1205 UA_VariableAttributes_encodeBinary(const UA_VariableAttributes *src, UA_ByteString *dst, size_t *offset) {
1206  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES], NULL, NULL, dst, offset);
1207 }
1208 static UA_INLINE UA_StatusCode
1209 UA_VariableAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_VariableAttributes *dst) {
1210  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES]);
1211 }
1212 
1213 /* NotificationMessage */
1214 static UA_INLINE UA_StatusCode
1215 UA_NotificationMessage_encodeBinary(const UA_NotificationMessage *src, UA_ByteString *dst, size_t *offset) {
1216  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NOTIFICATIONMESSAGE], NULL, NULL, dst, offset);
1217 }
1218 static UA_INLINE UA_StatusCode
1219 UA_NotificationMessage_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NotificationMessage *dst) {
1220  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NOTIFICATIONMESSAGE]);
1221 }
1222 
1223 /* NodeAttributesMask */
1224 static UA_INLINE UA_StatusCode
1225 UA_NodeAttributesMask_encodeBinary(const UA_NodeAttributesMask *src, UA_ByteString *dst, size_t *offset) {
1226  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODEATTRIBUTESMASK], NULL, NULL, dst, offset);
1227 }
1228 static UA_INLINE UA_StatusCode
1229 UA_NodeAttributesMask_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NodeAttributesMask *dst) {
1230  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODEATTRIBUTESMASK]);
1231 }
1232 
1233 /* MonitoringMode */
1234 static UA_INLINE UA_StatusCode
1235 UA_MonitoringMode_encodeBinary(const UA_MonitoringMode *src, UA_ByteString *dst, size_t *offset) {
1236  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MONITORINGMODE], NULL, NULL, dst, offset);
1237 }
1238 static UA_INLINE UA_StatusCode
1239 UA_MonitoringMode_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoringMode *dst) {
1240  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITORINGMODE]);
1241 }
1242 
1243 /* CallMethodResult */
1244 static UA_INLINE UA_StatusCode
1245 UA_CallMethodResult_encodeBinary(const UA_CallMethodResult *src, UA_ByteString *dst, size_t *offset) {
1246  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CALLMETHODRESULT], NULL, NULL, dst, offset);
1247 }
1248 static UA_INLINE UA_StatusCode
1249 UA_CallMethodResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CallMethodResult *dst) {
1250  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CALLMETHODRESULT]);
1251 }
1252 
1253 /* ParsingResult */
1254 static UA_INLINE UA_StatusCode
1255 UA_ParsingResult_encodeBinary(const UA_ParsingResult *src, UA_ByteString *dst, size_t *offset) {
1256  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_PARSINGRESULT], NULL, NULL, dst, offset);
1257 }
1258 static UA_INLINE UA_StatusCode
1259 UA_ParsingResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ParsingResult *dst) {
1260  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_PARSINGRESULT]);
1261 }
1262 
1263 /* RelativePathElement */
1264 static UA_INLINE UA_StatusCode
1265 UA_RelativePathElement_encodeBinary(const UA_RelativePathElement *src, UA_ByteString *dst, size_t *offset) {
1266  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_RELATIVEPATHELEMENT], NULL, NULL, dst, offset);
1267 }
1268 static UA_INLINE UA_StatusCode
1269 UA_RelativePathElement_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RelativePathElement *dst) {
1270  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_RELATIVEPATHELEMENT]);
1271 }
1272 
1273 /* BrowseDirection */
1274 static UA_INLINE UA_StatusCode
1275 UA_BrowseDirection_encodeBinary(const UA_BrowseDirection *src, UA_ByteString *dst, size_t *offset) {
1276  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEDIRECTION], NULL, NULL, dst, offset);
1277 }
1278 static UA_INLINE UA_StatusCode
1279 UA_BrowseDirection_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseDirection *dst) {
1280  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEDIRECTION]);
1281 }
1282 
1283 /* CallMethodRequest */
1284 static UA_INLINE UA_StatusCode
1285 UA_CallMethodRequest_encodeBinary(const UA_CallMethodRequest *src, UA_ByteString *dst, size_t *offset) {
1286  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CALLMETHODREQUEST], NULL, NULL, dst, offset);
1287 }
1288 static UA_INLINE UA_StatusCode
1289 UA_CallMethodRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CallMethodRequest *dst) {
1290  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CALLMETHODREQUEST]);
1291 }
1292 
1293 /* UnregisterNodesRequest */
1294 static UA_INLINE UA_StatusCode
1295 UA_UnregisterNodesRequest_encodeBinary(const UA_UnregisterNodesRequest *src, UA_ByteString *dst, size_t *offset) {
1296  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UNREGISTERNODESREQUEST], NULL, NULL, dst, offset);
1297 }
1298 static UA_INLINE UA_StatusCode
1299 UA_UnregisterNodesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UnregisterNodesRequest *dst) {
1300  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UNREGISTERNODESREQUEST]);
1301 }
1302 
1303 /* ContentFilterElementResult */
1304 static UA_INLINE UA_StatusCode
1305 UA_ContentFilterElementResult_encodeBinary(const UA_ContentFilterElementResult *src, UA_ByteString *dst, size_t *offset) {
1307 }
1308 static UA_INLINE UA_StatusCode
1309 UA_ContentFilterElementResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ContentFilterElementResult *dst) {
1310  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CONTENTFILTERELEMENTRESULT]);
1311 }
1312 
1313 /* QueryDataSet */
1314 static UA_INLINE UA_StatusCode
1315 UA_QueryDataSet_encodeBinary(const UA_QueryDataSet *src, UA_ByteString *dst, size_t *offset) {
1316  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYDATASET], NULL, NULL, dst, offset);
1317 }
1318 static UA_INLINE UA_StatusCode
1319 UA_QueryDataSet_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryDataSet *dst) {
1320  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYDATASET]);
1321 }
1322 
1323 /* AnonymousIdentityToken */
1324 static UA_INLINE UA_StatusCode
1325 UA_AnonymousIdentityToken_encodeBinary(const UA_AnonymousIdentityToken *src, UA_ByteString *dst, size_t *offset) {
1326  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ANONYMOUSIDENTITYTOKEN], NULL, NULL, dst, offset);
1327 }
1328 static UA_INLINE UA_StatusCode
1329 UA_AnonymousIdentityToken_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AnonymousIdentityToken *dst) {
1330  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ANONYMOUSIDENTITYTOKEN]);
1331 }
1332 
1333 /* SetPublishingModeRequest */
1334 static UA_INLINE UA_StatusCode
1335 UA_SetPublishingModeRequest_encodeBinary(const UA_SetPublishingModeRequest *src, UA_ByteString *dst, size_t *offset) {
1336  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SETPUBLISHINGMODEREQUEST], NULL, NULL, dst, offset);
1337 }
1338 static UA_INLINE UA_StatusCode
1339 UA_SetPublishingModeRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SetPublishingModeRequest *dst) {
1340  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SETPUBLISHINGMODEREQUEST]);
1341 }
1342 
1343 /* TimestampsToReturn */
1344 static UA_INLINE UA_StatusCode
1345 UA_TimestampsToReturn_encodeBinary(const UA_TimestampsToReturn *src, UA_ByteString *dst, size_t *offset) {
1346  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_TIMESTAMPSTORETURN], NULL, NULL, dst, offset);
1347 }
1348 static UA_INLINE UA_StatusCode
1349 UA_TimestampsToReturn_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TimestampsToReturn *dst) {
1350  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_TIMESTAMPSTORETURN]);
1351 }
1352 
1353 /* CallRequest */
1354 static UA_INLINE UA_StatusCode
1355 UA_CallRequest_encodeBinary(const UA_CallRequest *src, UA_ByteString *dst, size_t *offset) {
1356  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CALLREQUEST], NULL, NULL, dst, offset);
1357 }
1358 static UA_INLINE UA_StatusCode
1359 UA_CallRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CallRequest *dst) {
1360  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CALLREQUEST]);
1361 }
1362 
1363 /* MethodAttributes */
1364 static UA_INLINE UA_StatusCode
1365 UA_MethodAttributes_encodeBinary(const UA_MethodAttributes *src, UA_ByteString *dst, size_t *offset) {
1366  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_METHODATTRIBUTES], NULL, NULL, dst, offset);
1367 }
1368 static UA_INLINE UA_StatusCode
1369 UA_MethodAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MethodAttributes *dst) {
1370  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_METHODATTRIBUTES]);
1371 }
1372 
1373 /* DeleteReferencesItem */
1374 static UA_INLINE UA_StatusCode
1375 UA_DeleteReferencesItem_encodeBinary(const UA_DeleteReferencesItem *src, UA_ByteString *dst, size_t *offset) {
1376  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETEREFERENCESITEM], NULL, NULL, dst, offset);
1377 }
1378 static UA_INLINE UA_StatusCode
1379 UA_DeleteReferencesItem_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteReferencesItem *dst) {
1380  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETEREFERENCESITEM]);
1381 }
1382 
1383 /* WriteValue */
1384 static UA_INLINE UA_StatusCode
1385 UA_WriteValue_encodeBinary(const UA_WriteValue *src, UA_ByteString *dst, size_t *offset) {
1386  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_WRITEVALUE], NULL, NULL, dst, offset);
1387 }
1388 static UA_INLINE UA_StatusCode
1389 UA_WriteValue_decodeBinary(const UA_ByteString *src, size_t *offset, UA_WriteValue *dst) {
1390  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_WRITEVALUE]);
1391 }
1392 
1393 /* MonitoredItemCreateResult */
1394 static UA_INLINE UA_StatusCode
1395 UA_MonitoredItemCreateResult_encodeBinary(const UA_MonitoredItemCreateResult *src, UA_ByteString *dst, size_t *offset) {
1397 }
1398 static UA_INLINE UA_StatusCode
1399 UA_MonitoredItemCreateResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoredItemCreateResult *dst) {
1400  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMCREATERESULT]);
1401 }
1402 
1403 /* MessageSecurityMode */
1404 static UA_INLINE UA_StatusCode
1405 UA_MessageSecurityMode_encodeBinary(const UA_MessageSecurityMode *src, UA_ByteString *dst, size_t *offset) {
1406  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MESSAGESECURITYMODE], NULL, NULL, dst, offset);
1407 }
1408 static UA_INLINE UA_StatusCode
1409 UA_MessageSecurityMode_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MessageSecurityMode *dst) {
1410  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MESSAGESECURITYMODE]);
1411 }
1412 
1413 /* MonitoringParameters */
1414 static UA_INLINE UA_StatusCode
1415 UA_MonitoringParameters_encodeBinary(const UA_MonitoringParameters *src, UA_ByteString *dst, size_t *offset) {
1416  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_MONITORINGPARAMETERS], NULL, NULL, dst, offset);
1417 }
1418 static UA_INLINE UA_StatusCode
1419 UA_MonitoringParameters_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoringParameters *dst) {
1420  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITORINGPARAMETERS]);
1421 }
1422 
1423 /* SignatureData */
1424 static UA_INLINE UA_StatusCode
1425 UA_SignatureData_encodeBinary(const UA_SignatureData *src, UA_ByteString *dst, size_t *offset) {
1426  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SIGNATUREDATA], NULL, NULL, dst, offset);
1427 }
1428 static UA_INLINE UA_StatusCode
1429 UA_SignatureData_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SignatureData *dst) {
1430  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SIGNATUREDATA]);
1431 }
1432 
1433 /* ReferenceNode */
1434 static UA_INLINE UA_StatusCode
1435 UA_ReferenceNode_encodeBinary(const UA_ReferenceNode *src, UA_ByteString *dst, size_t *offset) {
1436  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REFERENCENODE], NULL, NULL, dst, offset);
1437 }
1438 static UA_INLINE UA_StatusCode
1439 UA_ReferenceNode_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReferenceNode *dst) {
1440  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REFERENCENODE]);
1441 }
1442 
1443 /* Argument */
1444 static UA_INLINE UA_StatusCode
1445 UA_Argument_encodeBinary(const UA_Argument *src, UA_ByteString *dst, size_t *offset) {
1446  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ARGUMENT], NULL, NULL, dst, offset);
1447 }
1448 static UA_INLINE UA_StatusCode
1449 UA_Argument_decodeBinary(const UA_ByteString *src, size_t *offset, UA_Argument *dst) {
1450  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ARGUMENT]);
1451 }
1452 
1453 /* UserIdentityToken */
1454 static UA_INLINE UA_StatusCode
1455 UA_UserIdentityToken_encodeBinary(const UA_UserIdentityToken *src, UA_ByteString *dst, size_t *offset) {
1456  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_USERIDENTITYTOKEN], NULL, NULL, dst, offset);
1457 }
1458 static UA_INLINE UA_StatusCode
1459 UA_UserIdentityToken_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UserIdentityToken *dst) {
1460  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_USERIDENTITYTOKEN]);
1461 }
1462 
1463 /* ObjectTypeAttributes */
1464 static UA_INLINE UA_StatusCode
1465 UA_ObjectTypeAttributes_encodeBinary(const UA_ObjectTypeAttributes *src, UA_ByteString *dst, size_t *offset) {
1466  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES], NULL, NULL, dst, offset);
1467 }
1468 static UA_INLINE UA_StatusCode
1469 UA_ObjectTypeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ObjectTypeAttributes *dst) {
1470  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES]);
1471 }
1472 
1473 /* DeadbandType */
1474 static UA_INLINE UA_StatusCode
1475 UA_DeadbandType_encodeBinary(const UA_DeadbandType *src, UA_ByteString *dst, size_t *offset) {
1476  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DEADBANDTYPE], NULL, NULL, dst, offset);
1477 }
1478 static UA_INLINE UA_StatusCode
1479 UA_DeadbandType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeadbandType *dst) {
1480  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DEADBANDTYPE]);
1481 }
1482 
1483 /* SecurityTokenRequestType */
1484 static UA_INLINE UA_StatusCode
1485 UA_SecurityTokenRequestType_encodeBinary(const UA_SecurityTokenRequestType *src, UA_ByteString *dst, size_t *offset) {
1486  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SECURITYTOKENREQUESTTYPE], NULL, NULL, dst, offset);
1487 }
1488 static UA_INLINE UA_StatusCode
1489 UA_SecurityTokenRequestType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SecurityTokenRequestType *dst) {
1490  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SECURITYTOKENREQUESTTYPE]);
1491 }
1492 
1493 /* DataChangeTrigger */
1494 static UA_INLINE UA_StatusCode
1495 UA_DataChangeTrigger_encodeBinary(const UA_DataChangeTrigger *src, UA_ByteString *dst, size_t *offset) {
1496  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATACHANGETRIGGER], NULL, NULL, dst, offset);
1497 }
1498 static UA_INLINE UA_StatusCode
1499 UA_DataChangeTrigger_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DataChangeTrigger *dst) {
1500  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATACHANGETRIGGER]);
1501 }
1502 
1503 /* BuildInfo */
1504 static UA_INLINE UA_StatusCode
1505 UA_BuildInfo_encodeBinary(const UA_BuildInfo *src, UA_ByteString *dst, size_t *offset) {
1506  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BUILDINFO], NULL, NULL, dst, offset);
1507 }
1508 static UA_INLINE UA_StatusCode
1509 UA_BuildInfo_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BuildInfo *dst) {
1510  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BUILDINFO]);
1511 }
1512 
1513 /* NodeClass */
1514 static UA_INLINE UA_StatusCode
1515 UA_NodeClass_encodeBinary(const UA_NodeClass *src, UA_ByteString *dst, size_t *offset) {
1516  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODECLASS], NULL, NULL, dst, offset);
1517 }
1518 static UA_INLINE UA_StatusCode
1519 UA_NodeClass_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NodeClass *dst) {
1520  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODECLASS]);
1521 }
1522 
1523 /* ChannelSecurityToken */
1524 static UA_INLINE UA_StatusCode
1525 UA_ChannelSecurityToken_encodeBinary(const UA_ChannelSecurityToken *src, UA_ByteString *dst, size_t *offset) {
1526  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CHANNELSECURITYTOKEN], NULL, NULL, dst, offset);
1527 }
1528 static UA_INLINE UA_StatusCode
1529 UA_ChannelSecurityToken_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ChannelSecurityToken *dst) {
1530  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CHANNELSECURITYTOKEN]);
1531 }
1532 
1533 /* MonitoredItemNotification */
1534 static UA_INLINE UA_StatusCode
1535 UA_MonitoredItemNotification_encodeBinary(const UA_MonitoredItemNotification *src, UA_ByteString *dst, size_t *offset) {
1537 }
1538 static UA_INLINE UA_StatusCode
1539 UA_MonitoredItemNotification_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoredItemNotification *dst) {
1540  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMNOTIFICATION]);
1541 }
1542 
1543 /* DeleteNodesItem */
1544 static UA_INLINE UA_StatusCode
1545 UA_DeleteNodesItem_encodeBinary(const UA_DeleteNodesItem *src, UA_ByteString *dst, size_t *offset) {
1546  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETENODESITEM], NULL, NULL, dst, offset);
1547 }
1548 static UA_INLINE UA_StatusCode
1549 UA_DeleteNodesItem_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteNodesItem *dst) {
1550  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETENODESITEM]);
1551 }
1552 
1553 /* SubscriptionAcknowledgement */
1554 static UA_INLINE UA_StatusCode
1555 UA_SubscriptionAcknowledgement_encodeBinary(const UA_SubscriptionAcknowledgement *src, UA_ByteString *dst, size_t *offset) {
1557 }
1558 static UA_INLINE UA_StatusCode
1559 UA_SubscriptionAcknowledgement_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SubscriptionAcknowledgement *dst) {
1561 }
1562 
1563 /* ReadValueId */
1564 static UA_INLINE UA_StatusCode
1565 UA_ReadValueId_encodeBinary(const UA_ReadValueId *src, UA_ByteString *dst, size_t *offset) {
1566  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_READVALUEID], NULL, NULL, dst, offset);
1567 }
1568 static UA_INLINE UA_StatusCode
1569 UA_ReadValueId_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReadValueId *dst) {
1570  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_READVALUEID]);
1571 }
1572 
1573 /* DataTypeAttributes */
1574 static UA_INLINE UA_StatusCode
1575 UA_DataTypeAttributes_encodeBinary(const UA_DataTypeAttributes *src, UA_ByteString *dst, size_t *offset) {
1576  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES], NULL, NULL, dst, offset);
1577 }
1578 static UA_INLINE UA_StatusCode
1579 UA_DataTypeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DataTypeAttributes *dst) {
1580  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES]);
1581 }
1582 
1583 /* ResponseHeader */
1584 static UA_INLINE UA_StatusCode
1585 UA_ResponseHeader_encodeBinary(const UA_ResponseHeader *src, UA_ByteString *dst, size_t *offset) {
1586  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_RESPONSEHEADER], NULL, NULL, dst, offset);
1587 }
1588 static UA_INLINE UA_StatusCode
1589 UA_ResponseHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ResponseHeader *dst) {
1590  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_RESPONSEHEADER]);
1591 }
1592 
1593 /* DeleteSubscriptionsRequest */
1594 static UA_INLINE UA_StatusCode
1595 UA_DeleteSubscriptionsRequest_encodeBinary(const UA_DeleteSubscriptionsRequest *src, UA_ByteString *dst, size_t *offset) {
1597 }
1598 static UA_INLINE UA_StatusCode
1599 UA_DeleteSubscriptionsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteSubscriptionsRequest *dst) {
1600  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSREQUEST]);
1601 }
1602 
1603 /* ViewDescription */
1604 static UA_INLINE UA_StatusCode
1605 UA_ViewDescription_encodeBinary(const UA_ViewDescription *src, UA_ByteString *dst, size_t *offset) {
1606  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VIEWDESCRIPTION], NULL, NULL, dst, offset);
1607 }
1608 static UA_INLINE UA_StatusCode
1609 UA_ViewDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ViewDescription *dst) {
1610  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VIEWDESCRIPTION]);
1611 }
1612 
1613 /* DeleteMonitoredItemsResponse */
1614 static UA_INLINE UA_StatusCode
1615 UA_DeleteMonitoredItemsResponse_encodeBinary(const UA_DeleteMonitoredItemsResponse *src, UA_ByteString *dst, size_t *offset) {
1617 }
1618 static UA_INLINE UA_StatusCode
1619 UA_DeleteMonitoredItemsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteMonitoredItemsResponse *dst) {
1621 }
1622 
1623 /* NodeAttributes */
1624 static UA_INLINE UA_StatusCode
1625 UA_NodeAttributes_encodeBinary(const UA_NodeAttributes *src, UA_ByteString *dst, size_t *offset) {
1626  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODEATTRIBUTES], NULL, NULL, dst, offset);
1627 }
1628 static UA_INLINE UA_StatusCode
1629 UA_NodeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NodeAttributes *dst) {
1630  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODEATTRIBUTES]);
1631 }
1632 
1633 /* RegisterNodesRequest */
1634 static UA_INLINE UA_StatusCode
1635 UA_RegisterNodesRequest_encodeBinary(const UA_RegisterNodesRequest *src, UA_ByteString *dst, size_t *offset) {
1636  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REGISTERNODESREQUEST], NULL, NULL, dst, offset);
1637 }
1638 static UA_INLINE UA_StatusCode
1639 UA_RegisterNodesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RegisterNodesRequest *dst) {
1640  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REGISTERNODESREQUEST]);
1641 }
1642 
1643 /* DeleteNodesRequest */
1644 static UA_INLINE UA_StatusCode
1645 UA_DeleteNodesRequest_encodeBinary(const UA_DeleteNodesRequest *src, UA_ByteString *dst, size_t *offset) {
1646  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETENODESREQUEST], NULL, NULL, dst, offset);
1647 }
1648 static UA_INLINE UA_StatusCode
1649 UA_DeleteNodesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteNodesRequest *dst) {
1650  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETENODESREQUEST]);
1651 }
1652 
1653 /* PublishResponse */
1654 static UA_INLINE UA_StatusCode
1655 UA_PublishResponse_encodeBinary(const UA_PublishResponse *src, UA_ByteString *dst, size_t *offset) {
1656  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_PUBLISHRESPONSE], NULL, NULL, dst, offset);
1657 }
1658 static UA_INLINE UA_StatusCode
1659 UA_PublishResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_PublishResponse *dst) {
1660  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_PUBLISHRESPONSE]);
1661 }
1662 
1663 /* MonitoredItemModifyRequest */
1664 static UA_INLINE UA_StatusCode
1665 UA_MonitoredItemModifyRequest_encodeBinary(const UA_MonitoredItemModifyRequest *src, UA_ByteString *dst, size_t *offset) {
1667 }
1668 static UA_INLINE UA_StatusCode
1669 UA_MonitoredItemModifyRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoredItemModifyRequest *dst) {
1670  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMMODIFYREQUEST]);
1671 }
1672 
1673 /* UserNameIdentityToken */
1674 static UA_INLINE UA_StatusCode
1675 UA_UserNameIdentityToken_encodeBinary(const UA_UserNameIdentityToken *src, UA_ByteString *dst, size_t *offset) {
1676  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_USERNAMEIDENTITYTOKEN], NULL, NULL, dst, offset);
1677 }
1678 static UA_INLINE UA_StatusCode
1679 UA_UserNameIdentityToken_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UserNameIdentityToken *dst) {
1680  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_USERNAMEIDENTITYTOKEN]);
1681 }
1682 
1683 /* IdType */
1684 static UA_INLINE UA_StatusCode
1685 UA_IdType_encodeBinary(const UA_IdType *src, UA_ByteString *dst, size_t *offset) {
1686  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_IDTYPE], NULL, NULL, dst, offset);
1687 }
1688 static UA_INLINE UA_StatusCode
1689 UA_IdType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_IdType *dst) {
1690  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_IDTYPE]);
1691 }
1692 
1693 /* UserTokenType */
1694 static UA_INLINE UA_StatusCode
1695 UA_UserTokenType_encodeBinary(const UA_UserTokenType *src, UA_ByteString *dst, size_t *offset) {
1696  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_USERTOKENTYPE], NULL, NULL, dst, offset);
1697 }
1698 static UA_INLINE UA_StatusCode
1699 UA_UserTokenType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UserTokenType *dst) {
1700  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_USERTOKENTYPE]);
1701 }
1702 
1703 /* ActivateSessionRequest */
1704 static UA_INLINE UA_StatusCode
1705 UA_ActivateSessionRequest_encodeBinary(const UA_ActivateSessionRequest *src, UA_ByteString *dst, size_t *offset) {
1706  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST], NULL, NULL, dst, offset);
1707 }
1708 static UA_INLINE UA_StatusCode
1709 UA_ActivateSessionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ActivateSessionRequest *dst) {
1710  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST]);
1711 }
1712 
1713 /* OpenSecureChannelResponse */
1714 static UA_INLINE UA_StatusCode
1715 UA_OpenSecureChannelResponse_encodeBinary(const UA_OpenSecureChannelResponse *src, UA_ByteString *dst, size_t *offset) {
1717 }
1718 static UA_INLINE UA_StatusCode
1719 UA_OpenSecureChannelResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_OpenSecureChannelResponse *dst) {
1720  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_OPENSECURECHANNELRESPONSE]);
1721 }
1722 
1723 /* ApplicationType */
1724 static UA_INLINE UA_StatusCode
1725 UA_ApplicationType_encodeBinary(const UA_ApplicationType *src, UA_ByteString *dst, size_t *offset) {
1726  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_APPLICATIONTYPE], NULL, NULL, dst, offset);
1727 }
1728 static UA_INLINE UA_StatusCode
1729 UA_ApplicationType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ApplicationType *dst) {
1730  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_APPLICATIONTYPE]);
1731 }
1732 
1733 /* ServerState */
1734 static UA_INLINE UA_StatusCode
1735 UA_ServerState_encodeBinary(const UA_ServerState *src, UA_ByteString *dst, size_t *offset) {
1736  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SERVERSTATE], NULL, NULL, dst, offset);
1737 }
1738 static UA_INLINE UA_StatusCode
1739 UA_ServerState_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ServerState *dst) {
1740  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SERVERSTATE]);
1741 }
1742 
1743 /* QueryNextResponse */
1744 static UA_INLINE UA_StatusCode
1745 UA_QueryNextResponse_encodeBinary(const UA_QueryNextResponse *src, UA_ByteString *dst, size_t *offset) {
1746  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYNEXTRESPONSE], NULL, NULL, dst, offset);
1747 }
1748 static UA_INLINE UA_StatusCode
1749 UA_QueryNextResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryNextResponse *dst) {
1750  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYNEXTRESPONSE]);
1751 }
1752 
1753 /* ActivateSessionResponse */
1754 static UA_INLINE UA_StatusCode
1755 UA_ActivateSessionResponse_encodeBinary(const UA_ActivateSessionResponse *src, UA_ByteString *dst, size_t *offset) {
1756  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ACTIVATESESSIONRESPONSE], NULL, NULL, dst, offset);
1757 }
1758 static UA_INLINE UA_StatusCode
1759 UA_ActivateSessionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ActivateSessionResponse *dst) {
1760  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ACTIVATESESSIONRESPONSE]);
1761 }
1762 
1763 /* FilterOperator */
1764 static UA_INLINE UA_StatusCode
1765 UA_FilterOperator_encodeBinary(const UA_FilterOperator *src, UA_ByteString *dst, size_t *offset) {
1766  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FILTEROPERATOR], NULL, NULL, dst, offset);
1767 }
1768 static UA_INLINE UA_StatusCode
1769 UA_FilterOperator_decodeBinary(const UA_ByteString *src, size_t *offset, UA_FilterOperator *dst) {
1770  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FILTEROPERATOR]);
1771 }
1772 
1773 /* QueryNextRequest */
1774 static UA_INLINE UA_StatusCode
1775 UA_QueryNextRequest_encodeBinary(const UA_QueryNextRequest *src, UA_ByteString *dst, size_t *offset) {
1776  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYNEXTREQUEST], NULL, NULL, dst, offset);
1777 }
1778 static UA_INLINE UA_StatusCode
1779 UA_QueryNextRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryNextRequest *dst) {
1780  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYNEXTREQUEST]);
1781 }
1782 
1783 /* WriteResponse */
1784 static UA_INLINE UA_StatusCode
1785 UA_WriteResponse_encodeBinary(const UA_WriteResponse *src, UA_ByteString *dst, size_t *offset) {
1786  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_WRITERESPONSE], NULL, NULL, dst, offset);
1787 }
1788 static UA_INLINE UA_StatusCode
1789 UA_WriteResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_WriteResponse *dst) {
1790  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_WRITERESPONSE]);
1791 }
1792 
1793 /* BrowseNextRequest */
1794 static UA_INLINE UA_StatusCode
1795 UA_BrowseNextRequest_encodeBinary(const UA_BrowseNextRequest *src, UA_ByteString *dst, size_t *offset) {
1796  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSENEXTREQUEST], NULL, NULL, dst, offset);
1797 }
1798 static UA_INLINE UA_StatusCode
1799 UA_BrowseNextRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseNextRequest *dst) {
1800  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSENEXTREQUEST]);
1801 }
1802 
1803 /* CreateSubscriptionRequest */
1804 static UA_INLINE UA_StatusCode
1805 UA_CreateSubscriptionRequest_encodeBinary(const UA_CreateSubscriptionRequest *src, UA_ByteString *dst, size_t *offset) {
1807 }
1808 static UA_INLINE UA_StatusCode
1809 UA_CreateSubscriptionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateSubscriptionRequest *dst) {
1810  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONREQUEST]);
1811 }
1812 
1813 /* VariableTypeAttributes */
1814 static UA_INLINE UA_StatusCode
1815 UA_VariableTypeAttributes_encodeBinary(const UA_VariableTypeAttributes *src, UA_ByteString *dst, size_t *offset) {
1816  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES], NULL, NULL, dst, offset);
1817 }
1818 static UA_INLINE UA_StatusCode
1819 UA_VariableTypeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_VariableTypeAttributes *dst) {
1820  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES]);
1821 }
1822 
1823 /* BrowsePathResult */
1824 static UA_INLINE UA_StatusCode
1825 UA_BrowsePathResult_encodeBinary(const UA_BrowsePathResult *src, UA_ByteString *dst, size_t *offset) {
1826  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEPATHRESULT], NULL, NULL, dst, offset);
1827 }
1828 static UA_INLINE UA_StatusCode
1829 UA_BrowsePathResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowsePathResult *dst) {
1830  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEPATHRESULT]);
1831 }
1832 
1833 /* ModifySubscriptionResponse */
1834 static UA_INLINE UA_StatusCode
1835 UA_ModifySubscriptionResponse_encodeBinary(const UA_ModifySubscriptionResponse *src, UA_ByteString *dst, size_t *offset) {
1837 }
1838 static UA_INLINE UA_StatusCode
1839 UA_ModifySubscriptionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ModifySubscriptionResponse *dst) {
1840  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE]);
1841 }
1842 
1843 /* OpenSecureChannelRequest */
1844 static UA_INLINE UA_StatusCode
1845 UA_OpenSecureChannelRequest_encodeBinary(const UA_OpenSecureChannelRequest *src, UA_ByteString *dst, size_t *offset) {
1846  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_OPENSECURECHANNELREQUEST], NULL, NULL, dst, offset);
1847 }
1848 static UA_INLINE UA_StatusCode
1849 UA_OpenSecureChannelRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_OpenSecureChannelRequest *dst) {
1850  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_OPENSECURECHANNELREQUEST]);
1851 }
1852 
1853 /* RegisterNodesResponse */
1854 static UA_INLINE UA_StatusCode
1855 UA_RegisterNodesResponse_encodeBinary(const UA_RegisterNodesResponse *src, UA_ByteString *dst, size_t *offset) {
1856  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REGISTERNODESRESPONSE], NULL, NULL, dst, offset);
1857 }
1858 static UA_INLINE UA_StatusCode
1859 UA_RegisterNodesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RegisterNodesResponse *dst) {
1860  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REGISTERNODESRESPONSE]);
1861 }
1862 
1863 /* CloseSessionRequest */
1864 static UA_INLINE UA_StatusCode
1865 UA_CloseSessionRequest_encodeBinary(const UA_CloseSessionRequest *src, UA_ByteString *dst, size_t *offset) {
1866  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST], NULL, NULL, dst, offset);
1867 }
1868 static UA_INLINE UA_StatusCode
1869 UA_CloseSessionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CloseSessionRequest *dst) {
1870  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST]);
1871 }
1872 
1873 /* ModifySubscriptionRequest */
1874 static UA_INLINE UA_StatusCode
1875 UA_ModifySubscriptionRequest_encodeBinary(const UA_ModifySubscriptionRequest *src, UA_ByteString *dst, size_t *offset) {
1877 }
1878 static UA_INLINE UA_StatusCode
1879 UA_ModifySubscriptionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ModifySubscriptionRequest *dst) {
1880  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONREQUEST]);
1881 }
1882 
1883 /* UserTokenPolicy */
1884 static UA_INLINE UA_StatusCode
1885 UA_UserTokenPolicy_encodeBinary(const UA_UserTokenPolicy *src, UA_ByteString *dst, size_t *offset) {
1886  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_USERTOKENPOLICY], NULL, NULL, dst, offset);
1887 }
1888 static UA_INLINE UA_StatusCode
1889 UA_UserTokenPolicy_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UserTokenPolicy *dst) {
1890  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_USERTOKENPOLICY]);
1891 }
1892 
1893 /* DeleteMonitoredItemsRequest */
1894 static UA_INLINE UA_StatusCode
1895 UA_DeleteMonitoredItemsRequest_encodeBinary(const UA_DeleteMonitoredItemsRequest *src, UA_ByteString *dst, size_t *offset) {
1897 }
1898 static UA_INLINE UA_StatusCode
1899 UA_DeleteMonitoredItemsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteMonitoredItemsRequest *dst) {
1901 }
1902 
1903 /* ReferenceTypeAttributes */
1904 static UA_INLINE UA_StatusCode
1905 UA_ReferenceTypeAttributes_encodeBinary(const UA_ReferenceTypeAttributes *src, UA_ByteString *dst, size_t *offset) {
1906  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES], NULL, NULL, dst, offset);
1907 }
1908 static UA_INLINE UA_StatusCode
1909 UA_ReferenceTypeAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReferenceTypeAttributes *dst) {
1910  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES]);
1911 }
1912 
1913 /* SetMonitoringModeRequest */
1914 static UA_INLINE UA_StatusCode
1915 UA_SetMonitoringModeRequest_encodeBinary(const UA_SetMonitoringModeRequest *src, UA_ByteString *dst, size_t *offset) {
1916  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SETMONITORINGMODEREQUEST], NULL, NULL, dst, offset);
1917 }
1918 static UA_INLINE UA_StatusCode
1919 UA_SetMonitoringModeRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SetMonitoringModeRequest *dst) {
1920  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SETMONITORINGMODEREQUEST]);
1921 }
1922 
1923 /* UnregisterNodesResponse */
1924 static UA_INLINE UA_StatusCode
1925 UA_UnregisterNodesResponse_encodeBinary(const UA_UnregisterNodesResponse *src, UA_ByteString *dst, size_t *offset) {
1926  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_UNREGISTERNODESRESPONSE], NULL, NULL, dst, offset);
1927 }
1928 static UA_INLINE UA_StatusCode
1929 UA_UnregisterNodesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_UnregisterNodesResponse *dst) {
1930  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_UNREGISTERNODESRESPONSE]);
1931 }
1932 
1933 /* WriteRequest */
1934 static UA_INLINE UA_StatusCode
1935 UA_WriteRequest_encodeBinary(const UA_WriteRequest *src, UA_ByteString *dst, size_t *offset) {
1936  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_WRITEREQUEST], NULL, NULL, dst, offset);
1937 }
1938 static UA_INLINE UA_StatusCode
1939 UA_WriteRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_WriteRequest *dst) {
1940  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_WRITEREQUEST]);
1941 }
1942 
1943 /* ObjectAttributes */
1944 static UA_INLINE UA_StatusCode
1945 UA_ObjectAttributes_encodeBinary(const UA_ObjectAttributes *src, UA_ByteString *dst, size_t *offset) {
1946  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES], NULL, NULL, dst, offset);
1947 }
1948 static UA_INLINE UA_StatusCode
1949 UA_ObjectAttributes_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ObjectAttributes *dst) {
1950  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES]);
1951 }
1952 
1953 /* BrowseDescription */
1954 static UA_INLINE UA_StatusCode
1955 UA_BrowseDescription_encodeBinary(const UA_BrowseDescription *src, UA_ByteString *dst, size_t *offset) {
1956  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEDESCRIPTION], NULL, NULL, dst, offset);
1957 }
1958 static UA_INLINE UA_StatusCode
1959 UA_BrowseDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseDescription *dst) {
1960  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEDESCRIPTION]);
1961 }
1962 
1963 /* RepublishRequest */
1964 static UA_INLINE UA_StatusCode
1965 UA_RepublishRequest_encodeBinary(const UA_RepublishRequest *src, UA_ByteString *dst, size_t *offset) {
1966  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REPUBLISHREQUEST], NULL, NULL, dst, offset);
1967 }
1968 static UA_INLINE UA_StatusCode
1969 UA_RepublishRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RepublishRequest *dst) {
1970  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REPUBLISHREQUEST]);
1971 }
1972 
1973 /* GetEndpointsRequest */
1974 static UA_INLINE UA_StatusCode
1975 UA_GetEndpointsRequest_encodeBinary(const UA_GetEndpointsRequest *src, UA_ByteString *dst, size_t *offset) {
1976  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_GETENDPOINTSREQUEST], NULL, NULL, dst, offset);
1977 }
1978 static UA_INLINE UA_StatusCode
1979 UA_GetEndpointsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_GetEndpointsRequest *dst) {
1980  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_GETENDPOINTSREQUEST]);
1981 }
1982 
1983 /* PublishRequest */
1984 static UA_INLINE UA_StatusCode
1985 UA_PublishRequest_encodeBinary(const UA_PublishRequest *src, UA_ByteString *dst, size_t *offset) {
1986  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_PUBLISHREQUEST], NULL, NULL, dst, offset);
1987 }
1988 static UA_INLINE UA_StatusCode
1989 UA_PublishRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_PublishRequest *dst) {
1990  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_PUBLISHREQUEST]);
1991 }
1992 
1993 /* AddNodesResponse */
1994 static UA_INLINE UA_StatusCode
1995 UA_AddNodesResponse_encodeBinary(const UA_AddNodesResponse *src, UA_ByteString *dst, size_t *offset) {
1996  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDNODESRESPONSE], NULL, NULL, dst, offset);
1997 }
1998 static UA_INLINE UA_StatusCode
1999 UA_AddNodesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddNodesResponse *dst) {
2000  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDNODESRESPONSE]);
2001 }
2002 
2003 /* DataChangeNotification */
2004 static UA_INLINE UA_StatusCode
2005 UA_DataChangeNotification_encodeBinary(const UA_DataChangeNotification *src, UA_ByteString *dst, size_t *offset) {
2006  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATACHANGENOTIFICATION], NULL, NULL, dst, offset);
2007 }
2008 static UA_INLINE UA_StatusCode
2009 UA_DataChangeNotification_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DataChangeNotification *dst) {
2010  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATACHANGENOTIFICATION]);
2011 }
2012 
2013 /* CloseSecureChannelResponse */
2014 static UA_INLINE UA_StatusCode
2015 UA_CloseSecureChannelResponse_encodeBinary(const UA_CloseSecureChannelResponse *src, UA_ByteString *dst, size_t *offset) {
2017 }
2018 static UA_INLINE UA_StatusCode
2019 UA_CloseSecureChannelResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CloseSecureChannelResponse *dst) {
2020  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CLOSESECURECHANNELRESPONSE]);
2021 }
2022 
2023 /* ModifyMonitoredItemsRequest */
2024 static UA_INLINE UA_StatusCode
2025 UA_ModifyMonitoredItemsRequest_encodeBinary(const UA_ModifyMonitoredItemsRequest *src, UA_ByteString *dst, size_t *offset) {
2027 }
2028 static UA_INLINE UA_StatusCode
2029 UA_ModifyMonitoredItemsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ModifyMonitoredItemsRequest *dst) {
2031 }
2032 
2033 /* SetMonitoringModeResponse */
2034 static UA_INLINE UA_StatusCode
2035 UA_SetMonitoringModeResponse_encodeBinary(const UA_SetMonitoringModeResponse *src, UA_ByteString *dst, size_t *offset) {
2037 }
2038 static UA_INLINE UA_StatusCode
2039 UA_SetMonitoringModeResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SetMonitoringModeResponse *dst) {
2040  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SETMONITORINGMODERESPONSE]);
2041 }
2042 
2043 /* FindServersRequest */
2044 static UA_INLINE UA_StatusCode
2045 UA_FindServersRequest_encodeBinary(const UA_FindServersRequest *src, UA_ByteString *dst, size_t *offset) {
2046  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FINDSERVERSREQUEST], NULL, NULL, dst, offset);
2047 }
2048 static UA_INLINE UA_StatusCode
2049 UA_FindServersRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_FindServersRequest *dst) {
2050  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FINDSERVERSREQUEST]);
2051 }
2052 
2053 /* ReferenceDescription */
2054 static UA_INLINE UA_StatusCode
2055 UA_ReferenceDescription_encodeBinary(const UA_ReferenceDescription *src, UA_ByteString *dst, size_t *offset) {
2056  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REFERENCEDESCRIPTION], NULL, NULL, dst, offset);
2057 }
2058 static UA_INLINE UA_StatusCode
2059 UA_ReferenceDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReferenceDescription *dst) {
2060  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REFERENCEDESCRIPTION]);
2061 }
2062 
2063 /* SetPublishingModeResponse */
2064 static UA_INLINE UA_StatusCode
2065 UA_SetPublishingModeResponse_encodeBinary(const UA_SetPublishingModeResponse *src, UA_ByteString *dst, size_t *offset) {
2067 }
2068 static UA_INLINE UA_StatusCode
2069 UA_SetPublishingModeResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SetPublishingModeResponse *dst) {
2070  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SETPUBLISHINGMODERESPONSE]);
2071 }
2072 
2073 /* ContentFilterResult */
2074 static UA_INLINE UA_StatusCode
2075 UA_ContentFilterResult_encodeBinary(const UA_ContentFilterResult *src, UA_ByteString *dst, size_t *offset) {
2076  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CONTENTFILTERRESULT], NULL, NULL, dst, offset);
2077 }
2078 static UA_INLINE UA_StatusCode
2079 UA_ContentFilterResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ContentFilterResult *dst) {
2080  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CONTENTFILTERRESULT]);
2081 }
2082 
2083 /* AddReferencesItem */
2084 static UA_INLINE UA_StatusCode
2085 UA_AddReferencesItem_encodeBinary(const UA_AddReferencesItem *src, UA_ByteString *dst, size_t *offset) {
2086  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDREFERENCESITEM], NULL, NULL, dst, offset);
2087 }
2088 static UA_INLINE UA_StatusCode
2089 UA_AddReferencesItem_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddReferencesItem *dst) {
2090  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDREFERENCESITEM]);
2091 }
2092 
2093 /* CreateSubscriptionResponse */
2094 static UA_INLINE UA_StatusCode
2095 UA_CreateSubscriptionResponse_encodeBinary(const UA_CreateSubscriptionResponse *src, UA_ByteString *dst, size_t *offset) {
2097 }
2098 static UA_INLINE UA_StatusCode
2099 UA_CreateSubscriptionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateSubscriptionResponse *dst) {
2100  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONRESPONSE]);
2101 }
2102 
2103 /* DeleteSubscriptionsResponse */
2104 static UA_INLINE UA_StatusCode
2105 UA_DeleteSubscriptionsResponse_encodeBinary(const UA_DeleteSubscriptionsResponse *src, UA_ByteString *dst, size_t *offset) {
2107 }
2108 static UA_INLINE UA_StatusCode
2109 UA_DeleteSubscriptionsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteSubscriptionsResponse *dst) {
2111 }
2112 
2113 /* RelativePath */
2114 static UA_INLINE UA_StatusCode
2115 UA_RelativePath_encodeBinary(const UA_RelativePath *src, UA_ByteString *dst, size_t *offset) {
2116  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_RELATIVEPATH], NULL, NULL, dst, offset);
2117 }
2118 static UA_INLINE UA_StatusCode
2119 UA_RelativePath_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RelativePath *dst) {
2120  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_RELATIVEPATH]);
2121 }
2122 
2123 /* DeleteReferencesResponse */
2124 static UA_INLINE UA_StatusCode
2125 UA_DeleteReferencesResponse_encodeBinary(const UA_DeleteReferencesResponse *src, UA_ByteString *dst, size_t *offset) {
2126  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETEREFERENCESRESPONSE], NULL, NULL, dst, offset);
2127 }
2128 static UA_INLINE UA_StatusCode
2129 UA_DeleteReferencesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteReferencesResponse *dst) {
2130  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETEREFERENCESRESPONSE]);
2131 }
2132 
2133 /* CreateMonitoredItemsResponse */
2134 static UA_INLINE UA_StatusCode
2135 UA_CreateMonitoredItemsResponse_encodeBinary(const UA_CreateMonitoredItemsResponse *src, UA_ByteString *dst, size_t *offset) {
2137 }
2138 static UA_INLINE UA_StatusCode
2139 UA_CreateMonitoredItemsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateMonitoredItemsResponse *dst) {
2141 }
2142 
2143 /* CallResponse */
2144 static UA_INLINE UA_StatusCode
2145 UA_CallResponse_encodeBinary(const UA_CallResponse *src, UA_ByteString *dst, size_t *offset) {
2146  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CALLRESPONSE], NULL, NULL, dst, offset);
2147 }
2148 static UA_INLINE UA_StatusCode
2149 UA_CallResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CallResponse *dst) {
2150  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CALLRESPONSE]);
2151 }
2152 
2153 /* DeleteNodesResponse */
2154 static UA_INLINE UA_StatusCode
2155 UA_DeleteNodesResponse_encodeBinary(const UA_DeleteNodesResponse *src, UA_ByteString *dst, size_t *offset) {
2156  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETENODESRESPONSE], NULL, NULL, dst, offset);
2157 }
2158 static UA_INLINE UA_StatusCode
2159 UA_DeleteNodesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteNodesResponse *dst) {
2160  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETENODESRESPONSE]);
2161 }
2162 
2163 /* RepublishResponse */
2164 static UA_INLINE UA_StatusCode
2165 UA_RepublishResponse_encodeBinary(const UA_RepublishResponse *src, UA_ByteString *dst, size_t *offset) {
2166  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_REPUBLISHRESPONSE], NULL, NULL, dst, offset);
2167 }
2168 static UA_INLINE UA_StatusCode
2169 UA_RepublishResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_RepublishResponse *dst) {
2170  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_REPUBLISHRESPONSE]);
2171 }
2172 
2173 /* MonitoredItemCreateRequest */
2174 static UA_INLINE UA_StatusCode
2175 UA_MonitoredItemCreateRequest_encodeBinary(const UA_MonitoredItemCreateRequest *src, UA_ByteString *dst, size_t *offset) {
2177 }
2178 static UA_INLINE UA_StatusCode
2179 UA_MonitoredItemCreateRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MonitoredItemCreateRequest *dst) {
2180  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_MONITOREDITEMCREATEREQUEST]);
2181 }
2182 
2183 /* DeleteReferencesRequest */
2184 static UA_INLINE UA_StatusCode
2185 UA_DeleteReferencesRequest_encodeBinary(const UA_DeleteReferencesRequest *src, UA_ByteString *dst, size_t *offset) {
2186  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DELETEREFERENCESREQUEST], NULL, NULL, dst, offset);
2187 }
2188 static UA_INLINE UA_StatusCode
2189 UA_DeleteReferencesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DeleteReferencesRequest *dst) {
2190  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DELETEREFERENCESREQUEST]);
2191 }
2192 
2193 /* ModifyMonitoredItemsResponse */
2194 static UA_INLINE UA_StatusCode
2195 UA_ModifyMonitoredItemsResponse_encodeBinary(const UA_ModifyMonitoredItemsResponse *src, UA_ByteString *dst, size_t *offset) {
2197 }
2198 static UA_INLINE UA_StatusCode
2199 UA_ModifyMonitoredItemsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ModifyMonitoredItemsResponse *dst) {
2201 }
2202 
2203 /* ReadResponse */
2204 static UA_INLINE UA_StatusCode
2205 UA_ReadResponse_encodeBinary(const UA_ReadResponse *src, UA_ByteString *dst, size_t *offset) {
2206  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_READRESPONSE], NULL, NULL, dst, offset);
2207 }
2208 static UA_INLINE UA_StatusCode
2209 UA_ReadResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReadResponse *dst) {
2210  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_READRESPONSE]);
2211 }
2212 
2213 /* AddReferencesRequest */
2214 static UA_INLINE UA_StatusCode
2215 UA_AddReferencesRequest_encodeBinary(const UA_AddReferencesRequest *src, UA_ByteString *dst, size_t *offset) {
2216  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDREFERENCESREQUEST], NULL, NULL, dst, offset);
2217 }
2218 static UA_INLINE UA_StatusCode
2219 UA_AddReferencesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddReferencesRequest *dst) {
2220  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDREFERENCESREQUEST]);
2221 }
2222 
2223 /* ReadRequest */
2224 static UA_INLINE UA_StatusCode
2225 UA_ReadRequest_encodeBinary(const UA_ReadRequest *src, UA_ByteString *dst, size_t *offset) {
2226  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_READREQUEST], NULL, NULL, dst, offset);
2227 }
2228 static UA_INLINE UA_StatusCode
2229 UA_ReadRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ReadRequest *dst) {
2230  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_READREQUEST]);
2231 }
2232 
2233 /* AddNodesItem */
2234 static UA_INLINE UA_StatusCode
2235 UA_AddNodesItem_encodeBinary(const UA_AddNodesItem *src, UA_ByteString *dst, size_t *offset) {
2236  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDNODESITEM], NULL, NULL, dst, offset);
2237 }
2238 static UA_INLINE UA_StatusCode
2239 UA_AddNodesItem_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddNodesItem *dst) {
2240  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDNODESITEM]);
2241 }
2242 
2243 /* ServerStatusDataType */
2244 static UA_INLINE UA_StatusCode
2245 UA_ServerStatusDataType_encodeBinary(const UA_ServerStatusDataType *src, UA_ByteString *dst, size_t *offset) {
2246  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE], NULL, NULL, dst, offset);
2247 }
2248 static UA_INLINE UA_StatusCode
2249 UA_ServerStatusDataType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ServerStatusDataType *dst) {
2250  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE]);
2251 }
2252 
2253 /* AddReferencesResponse */
2254 static UA_INLINE UA_StatusCode
2255 UA_AddReferencesResponse_encodeBinary(const UA_AddReferencesResponse *src, UA_ByteString *dst, size_t *offset) {
2256  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDREFERENCESRESPONSE], NULL, NULL, dst, offset);
2257 }
2258 static UA_INLINE UA_StatusCode
2259 UA_AddReferencesResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddReferencesResponse *dst) {
2260  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDREFERENCESRESPONSE]);
2261 }
2262 
2263 /* TranslateBrowsePathsToNodeIdsResponse */
2264 static UA_INLINE UA_StatusCode
2265 UA_TranslateBrowsePathsToNodeIdsResponse_encodeBinary(const UA_TranslateBrowsePathsToNodeIdsResponse *src, UA_ByteString *dst, size_t *offset) {
2267 }
2268 static UA_INLINE UA_StatusCode
2269 UA_TranslateBrowsePathsToNodeIdsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TranslateBrowsePathsToNodeIdsResponse *dst) {
2271 }
2272 
2273 /* DataChangeFilter */
2274 static UA_INLINE UA_StatusCode
2275 UA_DataChangeFilter_encodeBinary(const UA_DataChangeFilter *src, UA_ByteString *dst, size_t *offset) {
2276  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_DATACHANGEFILTER], NULL, NULL, dst, offset);
2277 }
2278 static UA_INLINE UA_StatusCode
2279 UA_DataChangeFilter_decodeBinary(const UA_ByteString *src, size_t *offset, UA_DataChangeFilter *dst) {
2280  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_DATACHANGEFILTER]);
2281 }
2282 
2283 /* ContentFilterElement */
2284 static UA_INLINE UA_StatusCode
2285 UA_ContentFilterElement_encodeBinary(const UA_ContentFilterElement *src, UA_ByteString *dst, size_t *offset) {
2286  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CONTENTFILTERELEMENT], NULL, NULL, dst, offset);
2287 }
2288 static UA_INLINE UA_StatusCode
2289 UA_ContentFilterElement_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ContentFilterElement *dst) {
2290  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CONTENTFILTERELEMENT]);
2291 }
2292 
2293 /* CloseSessionResponse */
2294 static UA_INLINE UA_StatusCode
2295 UA_CloseSessionResponse_encodeBinary(const UA_CloseSessionResponse *src, UA_ByteString *dst, size_t *offset) {
2296  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE], NULL, NULL, dst, offset);
2297 }
2298 static UA_INLINE UA_StatusCode
2299 UA_CloseSessionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CloseSessionResponse *dst) {
2300  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE]);
2301 }
2302 
2303 /* ApplicationDescription */
2304 static UA_INLINE UA_StatusCode
2305 UA_ApplicationDescription_encodeBinary(const UA_ApplicationDescription *src, UA_ByteString *dst, size_t *offset) {
2306  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_APPLICATIONDESCRIPTION], NULL, NULL, dst, offset);
2307 }
2308 static UA_INLINE UA_StatusCode
2309 UA_ApplicationDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ApplicationDescription *dst) {
2310  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_APPLICATIONDESCRIPTION]);
2311 }
2312 
2313 /* ServiceFault */
2314 static UA_INLINE UA_StatusCode
2315 UA_ServiceFault_encodeBinary(const UA_ServiceFault *src, UA_ByteString *dst, size_t *offset) {
2316  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_SERVICEFAULT], NULL, NULL, dst, offset);
2317 }
2318 static UA_INLINE UA_StatusCode
2319 UA_ServiceFault_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ServiceFault *dst) {
2320  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_SERVICEFAULT]);
2321 }
2322 
2323 /* FindServersResponse */
2324 static UA_INLINE UA_StatusCode
2325 UA_FindServersResponse_encodeBinary(const UA_FindServersResponse *src, UA_ByteString *dst, size_t *offset) {
2326  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_FINDSERVERSRESPONSE], NULL, NULL, dst, offset);
2327 }
2328 static UA_INLINE UA_StatusCode
2329 UA_FindServersResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_FindServersResponse *dst) {
2330  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_FINDSERVERSRESPONSE]);
2331 }
2332 
2333 /* CreateMonitoredItemsRequest */
2334 static UA_INLINE UA_StatusCode
2335 UA_CreateMonitoredItemsRequest_encodeBinary(const UA_CreateMonitoredItemsRequest *src, UA_ByteString *dst, size_t *offset) {
2337 }
2338 static UA_INLINE UA_StatusCode
2339 UA_CreateMonitoredItemsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateMonitoredItemsRequest *dst) {
2341 }
2342 
2343 /* ContentFilter */
2344 static UA_INLINE UA_StatusCode
2345 UA_ContentFilter_encodeBinary(const UA_ContentFilter *src, UA_ByteString *dst, size_t *offset) {
2346  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CONTENTFILTER], NULL, NULL, dst, offset);
2347 }
2348 static UA_INLINE UA_StatusCode
2349 UA_ContentFilter_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ContentFilter *dst) {
2350  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CONTENTFILTER]);
2351 }
2352 
2353 /* QueryFirstResponse */
2354 static UA_INLINE UA_StatusCode
2355 UA_QueryFirstResponse_encodeBinary(const UA_QueryFirstResponse *src, UA_ByteString *dst, size_t *offset) {
2356  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYFIRSTRESPONSE], NULL, NULL, dst, offset);
2357 }
2358 static UA_INLINE UA_StatusCode
2359 UA_QueryFirstResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryFirstResponse *dst) {
2360  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYFIRSTRESPONSE]);
2361 }
2362 
2363 /* AddNodesRequest */
2364 static UA_INLINE UA_StatusCode
2365 UA_AddNodesRequest_encodeBinary(const UA_AddNodesRequest *src, UA_ByteString *dst, size_t *offset) {
2366  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ADDNODESREQUEST], NULL, NULL, dst, offset);
2367 }
2368 static UA_INLINE UA_StatusCode
2369 UA_AddNodesRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AddNodesRequest *dst) {
2370  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ADDNODESREQUEST]);
2371 }
2372 
2373 /* BrowseRequest */
2374 static UA_INLINE UA_StatusCode
2375 UA_BrowseRequest_encodeBinary(const UA_BrowseRequest *src, UA_ByteString *dst, size_t *offset) {
2376  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEREQUEST], NULL, NULL, dst, offset);
2377 }
2378 static UA_INLINE UA_StatusCode
2379 UA_BrowseRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseRequest *dst) {
2380  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEREQUEST]);
2381 }
2382 
2383 /* BrowsePath */
2384 static UA_INLINE UA_StatusCode
2385 UA_BrowsePath_encodeBinary(const UA_BrowsePath *src, UA_ByteString *dst, size_t *offset) {
2386  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSEPATH], NULL, NULL, dst, offset);
2387 }
2388 static UA_INLINE UA_StatusCode
2389 UA_BrowsePath_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowsePath *dst) {
2390  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSEPATH]);
2391 }
2392 
2393 /* BrowseResult */
2394 static UA_INLINE UA_StatusCode
2395 UA_BrowseResult_encodeBinary(const UA_BrowseResult *src, UA_ByteString *dst, size_t *offset) {
2396  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSERESULT], NULL, NULL, dst, offset);
2397 }
2398 static UA_INLINE UA_StatusCode
2399 UA_BrowseResult_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseResult *dst) {
2400  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSERESULT]);
2401 }
2402 
2403 /* CreateSessionRequest */
2404 static UA_INLINE UA_StatusCode
2405 UA_CreateSessionRequest_encodeBinary(const UA_CreateSessionRequest *src, UA_ByteString *dst, size_t *offset) {
2406  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST], NULL, NULL, dst, offset);
2407 }
2408 static UA_INLINE UA_StatusCode
2409 UA_CreateSessionRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateSessionRequest *dst) {
2410  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST]);
2411 }
2412 
2413 /* QueryDataDescription */
2414 static UA_INLINE UA_StatusCode
2415 UA_QueryDataDescription_encodeBinary(const UA_QueryDataDescription *src, UA_ByteString *dst, size_t *offset) {
2416  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYDATADESCRIPTION], NULL, NULL, dst, offset);
2417 }
2418 static UA_INLINE UA_StatusCode
2419 UA_QueryDataDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryDataDescription *dst) {
2420  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYDATADESCRIPTION]);
2421 }
2422 
2423 /* EndpointDescription */
2424 static UA_INLINE UA_StatusCode
2425 UA_EndpointDescription_encodeBinary(const UA_EndpointDescription *src, UA_ByteString *dst, size_t *offset) {
2426  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION], NULL, NULL, dst, offset);
2427 }
2428 static UA_INLINE UA_StatusCode
2429 UA_EndpointDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_EndpointDescription *dst) {
2430  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
2431 }
2432 
2433 /* GetEndpointsResponse */
2434 static UA_INLINE UA_StatusCode
2435 UA_GetEndpointsResponse_encodeBinary(const UA_GetEndpointsResponse *src, UA_ByteString *dst, size_t *offset) {
2436  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_GETENDPOINTSRESPONSE], NULL, NULL, dst, offset);
2437 }
2438 static UA_INLINE UA_StatusCode
2439 UA_GetEndpointsResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_GetEndpointsResponse *dst) {
2440  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_GETENDPOINTSRESPONSE]);
2441 }
2442 
2443 /* NodeTypeDescription */
2444 static UA_INLINE UA_StatusCode
2445 UA_NodeTypeDescription_encodeBinary(const UA_NodeTypeDescription *src, UA_ByteString *dst, size_t *offset) {
2446  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_NODETYPEDESCRIPTION], NULL, NULL, dst, offset);
2447 }
2448 static UA_INLINE UA_StatusCode
2449 UA_NodeTypeDescription_decodeBinary(const UA_ByteString *src, size_t *offset, UA_NodeTypeDescription *dst) {
2450  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_NODETYPEDESCRIPTION]);
2451 }
2452 
2453 /* BrowseNextResponse */
2454 static UA_INLINE UA_StatusCode
2455 UA_BrowseNextResponse_encodeBinary(const UA_BrowseNextResponse *src, UA_ByteString *dst, size_t *offset) {
2456  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSENEXTRESPONSE], NULL, NULL, dst, offset);
2457 }
2458 static UA_INLINE UA_StatusCode
2459 UA_BrowseNextResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseNextResponse *dst) {
2460  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSENEXTRESPONSE]);
2461 }
2462 
2463 /* TranslateBrowsePathsToNodeIdsRequest */
2464 static UA_INLINE UA_StatusCode
2465 UA_TranslateBrowsePathsToNodeIdsRequest_encodeBinary(const UA_TranslateBrowsePathsToNodeIdsRequest *src, UA_ByteString *dst, size_t *offset) {
2467 }
2468 static UA_INLINE UA_StatusCode
2469 UA_TranslateBrowsePathsToNodeIdsRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TranslateBrowsePathsToNodeIdsRequest *dst) {
2471 }
2472 
2473 /* BrowseResponse */
2474 static UA_INLINE UA_StatusCode
2475 UA_BrowseResponse_encodeBinary(const UA_BrowseResponse *src, UA_ByteString *dst, size_t *offset) {
2476  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_BROWSERESPONSE], NULL, NULL, dst, offset);
2477 }
2478 static UA_INLINE UA_StatusCode
2479 UA_BrowseResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_BrowseResponse *dst) {
2480  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_BROWSERESPONSE]);
2481 }
2482 
2483 /* CreateSessionResponse */
2484 static UA_INLINE UA_StatusCode
2485 UA_CreateSessionResponse_encodeBinary(const UA_CreateSessionResponse *src, UA_ByteString *dst, size_t *offset) {
2486  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_CREATESESSIONRESPONSE], NULL, NULL, dst, offset);
2487 }
2488 static UA_INLINE UA_StatusCode
2489 UA_CreateSessionResponse_decodeBinary(const UA_ByteString *src, size_t *offset, UA_CreateSessionResponse *dst) {
2490  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_CREATESESSIONRESPONSE]);
2491 }
2492 
2493 /* QueryFirstRequest */
2494 static UA_INLINE UA_StatusCode
2495 UA_QueryFirstRequest_encodeBinary(const UA_QueryFirstRequest *src, UA_ByteString *dst, size_t *offset) {
2496  return UA_encodeBinary(src, &UA_TYPES[UA_TYPES_QUERYFIRSTREQUEST], NULL, NULL, dst, offset);
2497 }
2498 static UA_INLINE UA_StatusCode
2499 UA_QueryFirstRequest_decodeBinary(const UA_ByteString *src, size_t *offset, UA_QueryFirstRequest *dst) {
2500  return UA_decodeBinary(src, offset, dst, &UA_TYPES[UA_TYPES_QUERYFIRSTREQUEST]);
2501 }
2502 
2503 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_transport_generated.h" ***********************************/
2504 
2505 /* Generated from Opc.Ua.Types.bsd, Custom.Opc.Ua.Transport.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
2506  * on host iosb-VirtualBox by user iosb at 2018-08-29 05:32:08 */
2507 
2508 
2509 #ifdef __cplusplus
2510 extern "C" {
2511 #endif
2512 
2513 
2518 #define UA_TRANSPORT_COUNT 12
2520 
2525 typedef struct {
2529 
2530 #define UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY 0
2531 
2536 typedef struct {
2537  size_t paddingSize;
2541 
2542 #define UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER 1
2543 
2548 typedef struct {
2556 
2557 #define UA_TRANSPORT_TCPHELLOMESSAGE 2
2558 
2563 typedef struct {
2567 
2568 #define UA_TRANSPORT_TCPERRORMESSAGE 3
2569 
2574 typedef enum {
2582 } UA_MessageType;
2583 UA_STATIC_ASSERT(sizeof(UA_MessageType) == sizeof(UA_Int32), enum_must_be_32bit);
2584 
2585 #define UA_TRANSPORT_MESSAGETYPE 4
2586 
2591 typedef struct {
2596 
2597 #define UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER 5
2598 
2603 typedef struct {
2610 
2611 #define UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE 6
2612 
2617 typedef struct {
2621 
2622 #define UA_TRANSPORT_SEQUENCEHEADER 7
2623 
2628 typedef struct {
2632 
2633 #define UA_TRANSPORT_TCPMESSAGEHEADER 8
2634 
2639 typedef enum {
2640  UA_CHUNKTYPE_FINAL = 0x46000000,
2642  UA_CHUNKTYPE_ABORT = 0x41000000,
2644 } UA_ChunkType;
2645 UA_STATIC_ASSERT(sizeof(UA_ChunkType) == sizeof(UA_Int32), enum_must_be_32bit);
2646 
2647 #define UA_TRANSPORT_CHUNKTYPE 9
2648 
2653 typedef struct {
2656 
2657 #define UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER 10
2658 
2663 typedef struct {
2667 
2668 #define UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER 11
2669 
2670 #ifdef __cplusplus
2671 } // extern "C"
2672 #endif
2673 
2674 
2675 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_transport_generated_handling.h" ***********************************/
2676 
2677 /* Generated from Opc.Ua.Types.bsd, Custom.Opc.Ua.Transport.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
2678  * on host iosb-VirtualBox by user iosb at 2018-08-29 05:32:08 */
2679 
2680 
2681 #ifdef __cplusplus
2682 extern "C" {
2683 #endif
2684 
2685 
2686 #if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6
2687 # pragma GCC diagnostic push
2688 # pragma GCC diagnostic ignored "-Wmissing-field-initializers"
2689 # pragma GCC diagnostic ignored "-Wmissing-braces"
2690 #endif
2691 
2692 
2693 /* SecureConversationMessageAbortBody */
2694 static UA_INLINE void
2695 UA_SecureConversationMessageAbortBody_init(UA_SecureConversationMessageAbortBody *p) {
2696  memset(p, 0, sizeof(UA_SecureConversationMessageAbortBody));
2697 }
2698 
2700 UA_SecureConversationMessageAbortBody_new(void) {
2702 }
2703 
2704 static UA_INLINE UA_StatusCode
2705 UA_SecureConversationMessageAbortBody_copy(const UA_SecureConversationMessageAbortBody *src, UA_SecureConversationMessageAbortBody *dst) {
2706  return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY]);
2707 }
2708 
2709 static UA_INLINE void
2710 UA_SecureConversationMessageAbortBody_deleteMembers(UA_SecureConversationMessageAbortBody *p) {
2712 }
2713 
2714 static UA_INLINE void
2715 UA_SecureConversationMessageAbortBody_delete(UA_SecureConversationMessageAbortBody *p) {
2717 }
2718 
2719 /* SecureConversationMessageFooter */
2720 static UA_INLINE void
2721 UA_SecureConversationMessageFooter_init(UA_SecureConversationMessageFooter *p) {
2722  memset(p, 0, sizeof(UA_SecureConversationMessageFooter));
2723 }
2724 
2726 UA_SecureConversationMessageFooter_new(void) {
2728 }
2729 
2730 static UA_INLINE UA_StatusCode
2731 UA_SecureConversationMessageFooter_copy(const UA_SecureConversationMessageFooter *src, UA_SecureConversationMessageFooter *dst) {
2732  return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER]);
2733 }
2734 
2735 static UA_INLINE void
2736 UA_SecureConversationMessageFooter_deleteMembers(UA_SecureConversationMessageFooter *p) {
2738 }
2739 
2740 static UA_INLINE void
2741 UA_SecureConversationMessageFooter_delete(UA_SecureConversationMessageFooter *p) {
2743 }
2744 
2745 /* TcpHelloMessage */
2746 static UA_INLINE void
2747 UA_TcpHelloMessage_init(UA_TcpHelloMessage *p) {
2748  memset(p, 0, sizeof(UA_TcpHelloMessage));
2749 }
2750 
2752 UA_TcpHelloMessage_new(void) {
2753  return (UA_TcpHelloMessage*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE]);
2754 }
2755 
2756 static UA_INLINE UA_StatusCode
2757 UA_TcpHelloMessage_copy(const UA_TcpHelloMessage *src, UA_TcpHelloMessage *dst) {
2758  return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE]);
2759 }
2760 
2761 static UA_INLINE void
2762 UA_TcpHelloMessage_deleteMembers(UA_TcpHelloMessage *p) {
2764 }
2765 
2766 static UA_INLINE void
2767 UA_TcpHelloMessage_delete(UA_TcpHelloMessage *p) {
2768  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE]);
2769 }
2770 
2771 /* TcpErrorMessage */
2772 static UA_INLINE void
2773 UA_TcpErrorMessage_init(UA_TcpErrorMessage *p) {
2774  memset(p, 0, sizeof(UA_TcpErrorMessage));
2775 }
2776 
2778 UA_TcpErrorMessage_new(void) {
2779  return (UA_TcpErrorMessage*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE]);
2780 }
2781 
2782 static UA_INLINE UA_StatusCode
2783 UA_TcpErrorMessage_copy(const UA_TcpErrorMessage *src, UA_TcpErrorMessage *dst) {
2784  return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE]);
2785 }
2786 
2787 static UA_INLINE void
2788 UA_TcpErrorMessage_deleteMembers(UA_TcpErrorMessage *p) {
2790 }
2791 
2792 static UA_INLINE void
2793 UA_TcpErrorMessage_delete(UA_TcpErrorMessage *p) {
2794  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE]);
2795 }
2796 
2797 /* MessageType */
2798 static UA_INLINE void
2799 UA_MessageType_init(UA_MessageType *p) {
2800  memset(p, 0, sizeof(UA_MessageType));
2801 }
2802 
2803 static UA_INLINE UA_MessageType *
2804 UA_MessageType_new(void) {
2805  return (UA_MessageType*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_MESSAGETYPE]);
2806 }
2807 
2808 static UA_INLINE UA_StatusCode
2809 UA_MessageType_copy(const UA_MessageType *src, UA_MessageType *dst) {
2810  *dst = *src;
2811  return UA_STATUSCODE_GOOD;
2812 }
2813 
2814 static UA_INLINE void
2815 UA_MessageType_deleteMembers(UA_MessageType *p) { }
2816 
2817 static UA_INLINE void
2818 UA_MessageType_delete(UA_MessageType *p) {
2819  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_MESSAGETYPE]);
2820 }
2821 
2822 /* AsymmetricAlgorithmSecurityHeader */
2823 static UA_INLINE void
2824 UA_AsymmetricAlgorithmSecurityHeader_init(UA_AsymmetricAlgorithmSecurityHeader *p) {
2825  memset(p, 0, sizeof(UA_AsymmetricAlgorithmSecurityHeader));
2826 }
2827 
2829 UA_AsymmetricAlgorithmSecurityHeader_new(void) {
2831 }
2832 
2833 static UA_INLINE UA_StatusCode
2834 UA_AsymmetricAlgorithmSecurityHeader_copy(const UA_AsymmetricAlgorithmSecurityHeader *src, UA_AsymmetricAlgorithmSecurityHeader *dst) {
2835  return UA_copy(src, dst, &UA_TRANSPORT[UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER]);
2836 }
2837 
2838 static UA_INLINE void
2839 UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(UA_AsymmetricAlgorithmSecurityHeader *p) {
2841 }
2842 
2843 static UA_INLINE void
2844 UA_AsymmetricAlgorithmSecurityHeader_delete(UA_AsymmetricAlgorithmSecurityHeader *p) {
2846 }
2847 
2848 /* TcpAcknowledgeMessage */
2849 static UA_INLINE void
2850 UA_TcpAcknowledgeMessage_init(UA_TcpAcknowledgeMessage *p) {
2851  memset(p, 0, sizeof(UA_TcpAcknowledgeMessage));
2852 }
2853 
2855 UA_TcpAcknowledgeMessage_new(void) {
2857 }
2858 
2859 static UA_INLINE UA_StatusCode
2860 UA_TcpAcknowledgeMessage_copy(const UA_TcpAcknowledgeMessage *src, UA_TcpAcknowledgeMessage *dst) {
2861  *dst = *src;
2862  return UA_STATUSCODE_GOOD;
2863 }
2864 
2865 static UA_INLINE void
2866 UA_TcpAcknowledgeMessage_deleteMembers(UA_TcpAcknowledgeMessage *p) { }
2867 
2868 static UA_INLINE void
2869 UA_TcpAcknowledgeMessage_delete(UA_TcpAcknowledgeMessage *p) {
2870  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE]);
2871 }
2872 
2873 /* SequenceHeader */
2874 static UA_INLINE void
2875 UA_SequenceHeader_init(UA_SequenceHeader *p) {
2876  memset(p, 0, sizeof(UA_SequenceHeader));
2877 }
2878 
2880 UA_SequenceHeader_new(void) {
2881  return (UA_SequenceHeader*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_SEQUENCEHEADER]);
2882 }
2883 
2884 static UA_INLINE UA_StatusCode
2885 UA_SequenceHeader_copy(const UA_SequenceHeader *src, UA_SequenceHeader *dst) {
2886  *dst = *src;
2887  return UA_STATUSCODE_GOOD;
2888 }
2889 
2890 static UA_INLINE void
2891 UA_SequenceHeader_deleteMembers(UA_SequenceHeader *p) { }
2892 
2893 static UA_INLINE void
2894 UA_SequenceHeader_delete(UA_SequenceHeader *p) {
2895  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_SEQUENCEHEADER]);
2896 }
2897 
2898 /* TcpMessageHeader */
2899 static UA_INLINE void
2900 UA_TcpMessageHeader_init(UA_TcpMessageHeader *p) {
2901  memset(p, 0, sizeof(UA_TcpMessageHeader));
2902 }
2903 
2905 UA_TcpMessageHeader_new(void) {
2906  return (UA_TcpMessageHeader*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_TCPMESSAGEHEADER]);
2907 }
2908 
2909 static UA_INLINE UA_StatusCode
2910 UA_TcpMessageHeader_copy(const UA_TcpMessageHeader *src, UA_TcpMessageHeader *dst) {
2911  *dst = *src;
2912  return UA_STATUSCODE_GOOD;
2913 }
2914 
2915 static UA_INLINE void
2916 UA_TcpMessageHeader_deleteMembers(UA_TcpMessageHeader *p) { }
2917 
2918 static UA_INLINE void
2919 UA_TcpMessageHeader_delete(UA_TcpMessageHeader *p) {
2920  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_TCPMESSAGEHEADER]);
2921 }
2922 
2923 /* ChunkType */
2924 static UA_INLINE void
2925 UA_ChunkType_init(UA_ChunkType *p) {
2926  memset(p, 0, sizeof(UA_ChunkType));
2927 }
2928 
2929 static UA_INLINE UA_ChunkType *
2930 UA_ChunkType_new(void) {
2931  return (UA_ChunkType*)UA_new(&UA_TRANSPORT[UA_TRANSPORT_CHUNKTYPE]);
2932 }
2933 
2934 static UA_INLINE UA_StatusCode
2935 UA_ChunkType_copy(const UA_ChunkType *src, UA_ChunkType *dst) {
2936  *dst = *src;
2937  return UA_STATUSCODE_GOOD;
2938 }
2939 
2940 static UA_INLINE void
2941 UA_ChunkType_deleteMembers(UA_ChunkType *p) { }
2942 
2943 static UA_INLINE void
2944 UA_ChunkType_delete(UA_ChunkType *p) {
2945  UA_delete(p, &UA_TRANSPORT[UA_TRANSPORT_CHUNKTYPE]);
2946 }
2947 
2948 /* SymmetricAlgorithmSecurityHeader */
2949 static UA_INLINE void
2950 UA_SymmetricAlgorithmSecurityHeader_init(UA_SymmetricAlgorithmSecurityHeader *p) {
2951  memset(p, 0, sizeof(UA_SymmetricAlgorithmSecurityHeader));
2952 }
2953 
2955 UA_SymmetricAlgorithmSecurityHeader_new(void) {
2957 }
2958 
2959 static UA_INLINE UA_StatusCode
2960 UA_SymmetricAlgorithmSecurityHeader_copy(const UA_SymmetricAlgorithmSecurityHeader *src, UA_SymmetricAlgorithmSecurityHeader *dst) {
2961  *dst = *src;
2962  return UA_STATUSCODE_GOOD;
2963 }
2964 
2965 static UA_INLINE void
2966 UA_SymmetricAlgorithmSecurityHeader_deleteMembers(UA_SymmetricAlgorithmSecurityHeader *p) { }
2967 
2968 static UA_INLINE void
2969 UA_SymmetricAlgorithmSecurityHeader_delete(UA_SymmetricAlgorithmSecurityHeader *p) {
2971 }
2972 
2973 /* SecureConversationMessageHeader */
2974 static UA_INLINE void
2975 UA_SecureConversationMessageHeader_init(UA_SecureConversationMessageHeader *p) {
2976  memset(p, 0, sizeof(UA_SecureConversationMessageHeader));
2977 }
2978 
2980 UA_SecureConversationMessageHeader_new(void) {
2982 }
2983 
2984 static UA_INLINE UA_StatusCode
2985 UA_SecureConversationMessageHeader_copy(const UA_SecureConversationMessageHeader *src, UA_SecureConversationMessageHeader *dst) {
2986  *dst = *src;
2987  return UA_STATUSCODE_GOOD;
2988 }
2989 
2990 static UA_INLINE void
2991 UA_SecureConversationMessageHeader_deleteMembers(UA_SecureConversationMessageHeader *p) { }
2992 
2993 static UA_INLINE void
2994 UA_SecureConversationMessageHeader_delete(UA_SecureConversationMessageHeader *p) {
2996 }
2997 
2998 #if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6
2999 # pragma GCC diagnostic pop
3000 #endif
3001 
3002 #ifdef __cplusplus
3003 } // extern "C"
3004 #endif
3005 
3006 
3007 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_transport_generated_encoding_binary.h" ***********************************/
3008 
3009 /* Generated from Opc.Ua.Types.bsd, Custom.Opc.Ua.Transport.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
3010  * on host iosb-VirtualBox by user iosb at 2018-08-29 05:32:08 */
3011 
3012 
3013 /* SecureConversationMessageAbortBody */
3014 static UA_INLINE UA_StatusCode
3015 UA_SecureConversationMessageAbortBody_encodeBinary(const UA_SecureConversationMessageAbortBody *src, UA_ByteString *dst, size_t *offset) {
3016  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY], NULL, NULL, dst, offset);
3017 }
3018 static UA_INLINE UA_StatusCode
3019 UA_SecureConversationMessageAbortBody_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SecureConversationMessageAbortBody *dst) {
3020  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY]);
3021 }
3022 
3023 /* SecureConversationMessageFooter */
3024 static UA_INLINE UA_StatusCode
3025 UA_SecureConversationMessageFooter_encodeBinary(const UA_SecureConversationMessageFooter *src, UA_ByteString *dst, size_t *offset) {
3026  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER], NULL, NULL, dst, offset);
3027 }
3028 static UA_INLINE UA_StatusCode
3029 UA_SecureConversationMessageFooter_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SecureConversationMessageFooter *dst) {
3030  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER]);
3031 }
3032 
3033 /* TcpHelloMessage */
3034 static UA_INLINE UA_StatusCode
3035 UA_TcpHelloMessage_encodeBinary(const UA_TcpHelloMessage *src, UA_ByteString *dst, size_t *offset) {
3036  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE], NULL, NULL, dst, offset);
3037 }
3038 static UA_INLINE UA_StatusCode
3039 UA_TcpHelloMessage_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TcpHelloMessage *dst) {
3040  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPHELLOMESSAGE]);
3041 }
3042 
3043 /* TcpErrorMessage */
3044 static UA_INLINE UA_StatusCode
3045 UA_TcpErrorMessage_encodeBinary(const UA_TcpErrorMessage *src, UA_ByteString *dst, size_t *offset) {
3046  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE], NULL, NULL, dst, offset);
3047 }
3048 static UA_INLINE UA_StatusCode
3049 UA_TcpErrorMessage_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TcpErrorMessage *dst) {
3050  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPERRORMESSAGE]);
3051 }
3052 
3053 /* MessageType */
3054 static UA_INLINE UA_StatusCode
3055 UA_MessageType_encodeBinary(const UA_MessageType *src, UA_ByteString *dst, size_t *offset) {
3056  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_MESSAGETYPE], NULL, NULL, dst, offset);
3057 }
3058 static UA_INLINE UA_StatusCode
3059 UA_MessageType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_MessageType *dst) {
3060  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_MESSAGETYPE]);
3061 }
3062 
3063 /* AsymmetricAlgorithmSecurityHeader */
3064 static UA_INLINE UA_StatusCode
3065 UA_AsymmetricAlgorithmSecurityHeader_encodeBinary(const UA_AsymmetricAlgorithmSecurityHeader *src, UA_ByteString *dst, size_t *offset) {
3066  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER], NULL, NULL, dst, offset);
3067 }
3068 static UA_INLINE UA_StatusCode
3069 UA_AsymmetricAlgorithmSecurityHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_AsymmetricAlgorithmSecurityHeader *dst) {
3070  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER]);
3071 }
3072 
3073 /* TcpAcknowledgeMessage */
3074 static UA_INLINE UA_StatusCode
3075 UA_TcpAcknowledgeMessage_encodeBinary(const UA_TcpAcknowledgeMessage *src, UA_ByteString *dst, size_t *offset) {
3076  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE], NULL, NULL, dst, offset);
3077 }
3078 static UA_INLINE UA_StatusCode
3079 UA_TcpAcknowledgeMessage_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TcpAcknowledgeMessage *dst) {
3080  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE]);
3081 }
3082 
3083 /* SequenceHeader */
3084 static UA_INLINE UA_StatusCode
3085 UA_SequenceHeader_encodeBinary(const UA_SequenceHeader *src, UA_ByteString *dst, size_t *offset) {
3086  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SEQUENCEHEADER], NULL, NULL, dst, offset);
3087 }
3088 static UA_INLINE UA_StatusCode
3089 UA_SequenceHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SequenceHeader *dst) {
3090  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SEQUENCEHEADER]);
3091 }
3092 
3093 /* TcpMessageHeader */
3094 static UA_INLINE UA_StatusCode
3095 UA_TcpMessageHeader_encodeBinary(const UA_TcpMessageHeader *src, UA_ByteString *dst, size_t *offset) {
3096  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_TCPMESSAGEHEADER], NULL, NULL, dst, offset);
3097 }
3098 static UA_INLINE UA_StatusCode
3099 UA_TcpMessageHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_TcpMessageHeader *dst) {
3100  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_TCPMESSAGEHEADER]);
3101 }
3102 
3103 /* ChunkType */
3104 static UA_INLINE UA_StatusCode
3105 UA_ChunkType_encodeBinary(const UA_ChunkType *src, UA_ByteString *dst, size_t *offset) {
3106  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_CHUNKTYPE], NULL, NULL, dst, offset);
3107 }
3108 static UA_INLINE UA_StatusCode
3109 UA_ChunkType_decodeBinary(const UA_ByteString *src, size_t *offset, UA_ChunkType *dst) {
3110  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_CHUNKTYPE]);
3111 }
3112 
3113 /* SymmetricAlgorithmSecurityHeader */
3114 static UA_INLINE UA_StatusCode
3115 UA_SymmetricAlgorithmSecurityHeader_encodeBinary(const UA_SymmetricAlgorithmSecurityHeader *src, UA_ByteString *dst, size_t *offset) {
3116  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER], NULL, NULL, dst, offset);
3117 }
3118 static UA_INLINE UA_StatusCode
3119 UA_SymmetricAlgorithmSecurityHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SymmetricAlgorithmSecurityHeader *dst) {
3120  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER]);
3121 }
3122 
3123 /* SecureConversationMessageHeader */
3124 static UA_INLINE UA_StatusCode
3125 UA_SecureConversationMessageHeader_encodeBinary(const UA_SecureConversationMessageHeader *src, UA_ByteString *dst, size_t *offset) {
3126  return UA_encodeBinary(src, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER], NULL, NULL, dst, offset);
3127 }
3128 static UA_INLINE UA_StatusCode
3129 UA_SecureConversationMessageHeader_decodeBinary(const UA_ByteString *src, size_t *offset, UA_SecureConversationMessageHeader *dst) {
3130  return UA_decodeBinary(src, offset, dst, &UA_TRANSPORT[UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER]);
3131 }
3132 
3133 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_connection_internal.h" ***********************************/
3134 
3135 /* This Source Code Form is subject to the terms of the Mozilla Public
3136 * License, v. 2.0. If a copy of the MPL was not distributed with this
3137 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3138 
3139 
3140 
3141 /* The network layer may receive chopped up messages since TCP is a streaming
3142  * protocol. Furthermore, the networklayer may operate on ringbuffers or
3143  * statically assigned memory.
3144  *
3145  * If an entire message is received, it is forwarded directly. But the memory
3146  * needs to be freed with the networklayer-specific mechanism. If a half message
3147  * is received, we copy it into a local buffer. Then, the stack-specific free
3148  * needs to be used.
3149  *
3150  * @param connection The connection
3151  * @param message The received message. The content may be overwritten when a
3152  * previsouly received buffer is completed.
3153  * @param realloced The Boolean value is set to true if the outgoing message has
3154  * been reallocated from the network layer.
3155  * @return Returns UA_STATUSCODE_GOOD or an error code. When an error occurs, the ingoing message
3156  * and the current buffer in the connection are freed. */
3159  UA_Boolean *realloced);
3160 
3161 /* Try to receive at least one complete chunk on the connection. This blocks the
3162  * current thread up to the given timeout.
3163  *
3164  * @param connection The connection
3165  * @param chunk The received chunk. The memory is allocated either by the
3166  * networklayer or internally.
3167  * @param realloced The Boolean value is set to true if the chunk has been
3168  * reallocated from the network layer.
3169  * @param timeout The timeout (in milliseconds) the method will block at most.
3170  * @return Returns UA_STATUSCODE_GOOD or an error code. When an error occurs,
3171  * the chunk buffer is returned empty. Upon a timeout,
3172  * UA_STATUSCODE_GOODNONCRITICALTIMEOUT is returned.
3173  */
3176  UA_Boolean *realloced, UA_UInt32 timeout);
3177 
3180 
3181 /* Split the given endpoint url into hostname and port. Some of the chunks are
3182  * returned as pointer.
3183  * @param endpointUrl The endpoint URL to split up
3184  * @param hostname the target array for hostname. Has to be at least 256 size.
3185  * @param port if url contains port, it will point to the beginning of port.
3186  * NULL otherwise. It may also include the path part, thus stop at
3187  * position of path pointer, if it is not NULL.
3188  * @param path points to the first occurance of '/' after the port or NULL if no
3189  * path in url
3190  * @return UA_STATUSCODE_BADOUTOFRANGE if url too long,
3191  * UA_STATUSCODE_BADATTRIBUTEIDINVALID if url not starting with
3192  * 'opc.tcp://', UA_STATUSCODE_GOOD on success */
3194 UA_EndpointUrl_split_ptr(const char *endpointUrl, char *hostname,
3195  const char ** port, const char ** path);
3196 
3197 
3198 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_securechannel.h" ***********************************/
3199 
3200 /* This Source Code Form is subject to the terms of the Mozilla Public
3201 * License, v. 2.0. If a copy of the MPL was not distributed with this
3202 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3203 
3204 
3205 
3206 struct UA_Session;
3207 typedef struct UA_Session UA_Session;
3208 
3210  LIST_ENTRY(SessionEntry) pointers;
3211  UA_Session *session; // Just a pointer. The session is held in the session manager or the client
3212 };
3213 
3214 /* For chunked requests */
3215 struct ChunkEntry {
3216  LIST_ENTRY(ChunkEntry) pointers;
3217  UA_UInt32 requestId;
3218  UA_ByteString bytes;
3219 };
3220 
3221 /* For chunked responses */
3222 typedef struct {
3228  UA_Boolean final;
3230 } UA_ChunkInfo;
3231 
3234  UA_ChannelSecurityToken securityToken; // the channelId is contained in the securityToken
3235  UA_ChannelSecurityToken nextSecurityToken; // the channelId is contained in the securityToken
3243  LIST_HEAD(session_pointerlist, SessionEntry) sessions;
3244  LIST_HEAD(chunk_pointerlist, ChunkEntry) chunks;
3245 };
3246 
3249 
3251 
3255 
3257  const void *content, const UA_DataType *contentType);
3258 
3260 
3264 typedef void
3265 (UA_ProcessMessageCallback)(void *application, UA_SecureChannel *channel,
3266  UA_MessageType messageType, UA_UInt32 requestId,
3267  const UA_ByteString *message);
3268 
3271  UA_ProcessMessageCallback callback, void *application);
3272 
3276 #define UA_LOG_TRACE_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3277  UA_LOG_TRACE(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3278  ((CHANNEL)->connection ? CHANNEL->connection->sockfd : 0), \
3279  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3280 
3281 #define UA_LOG_DEBUG_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3282  UA_LOG_DEBUG(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3283  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
3284  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3285 
3286 #define UA_LOG_INFO_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3287  UA_LOG_INFO(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3288  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
3289  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3290 
3291 #define UA_LOG_WARNING_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3292  UA_LOG_WARNING(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3293  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
3294  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3295 
3296 #define UA_LOG_ERROR_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3297  UA_LOG_ERROR(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3298  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
3299  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3300 
3301 #define UA_LOG_FATAL_CHANNEL(LOGGER, CHANNEL, MSG, ...) \
3302  UA_LOG_FATAL(LOGGER, UA_LOGCATEGORY_SECURECHANNEL, "Connection %i | SecureChannel %i | " MSG, \
3303  ((CHANNEL)->connection ? (CHANNEL)->connection->sockfd : 0), \
3304  (CHANNEL)->securityToken.channelId, ##__VA_ARGS__);
3305 
3306 
3307 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_nodes.h" ***********************************/
3308 
3309 /* This Source Code Form is subject to the terms of the Mozilla Public
3310 * License, v. 2.0. If a copy of the MPL was not distributed with this
3311 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3312 
3313 
3314 #ifdef __cplusplus
3315 extern "C" {
3316 #endif
3317 
3318 
3356 #define UA_NODE_BASEATTRIBUTES \
3357  UA_NodeId nodeId; \
3358  UA_NodeClass nodeClass; \
3359  UA_QualifiedName browseName; \
3360  UA_LocalizedText displayName; \
3361  UA_LocalizedText description; \
3362  UA_UInt32 writeMask; \
3363  UA_UInt32 userWriteMask; \
3364  size_t referencesSize; \
3365  UA_ReferenceNode *references;
3366 
3367 typedef struct {
3369 } UA_Node;
3370 
3436 /* Indicates whether a variable contains data inline or whether it points to an
3437  * external data source */
3438 typedef enum {
3441 } UA_ValueSource;
3442 
3443 #define UA_NODE_VARIABLEATTRIBUTES \
3444  /* Constraints on possible values */ \
3445  UA_NodeId dataType; \
3446  UA_Int32 valueRank; \
3447  size_t arrayDimensionsSize; \
3448  UA_UInt32 *arrayDimensions; \
3449  \
3450  /* The current value */ \
3451  UA_ValueSource valueSource; \
3452  union { \
3453  struct { \
3454  UA_DataValue value; \
3455  UA_ValueCallback callback; \
3456  } data; \
3457  UA_DataSource dataSource; \
3458  } value;
3459 
3460 typedef struct {
3466  UA_Boolean historizing; /* currently unsupported */
3467 } UA_VariableNode;
3468 
3481 typedef struct {
3486 
3505 typedef struct {
3509 
3510  /* Members specific to open62541 */
3512  UA_MethodCallback attachedMethod;
3513 } UA_MethodNode;
3514 
3523 typedef struct {
3526 
3527  /* Members specific to open62541 */
3529 } UA_ObjectNode;
3530 
3540 typedef struct {
3543 
3544  /* Members specific to open62541 */
3545  UA_ObjectLifecycleManagement lifecycleManagement;
3547 
3650 typedef struct {
3656 
3671 typedef struct {
3674 } UA_DataTypeNode;
3675 
3685 typedef struct {
3689 } UA_ViewNode;
3690 
3691 #ifdef __cplusplus
3692 } // extern "C"
3693 #endif
3694 
3695 
3696 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_session.h" ***********************************/
3697 
3698 /* This Source Code Form is subject to the terms of the Mozilla Public
3699 * License, v. 2.0. If a copy of the MPL was not distributed with this
3700 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3701 
3702 
3703 
3704 #define UA_MAXCONTINUATIONPOINTS 5
3705 
3708  UA_ByteString identifier;
3709  UA_BrowseDescription browseDescription;
3710  UA_UInt32 continuationIndex;
3711  UA_UInt32 maxReferences;
3712 };
3713 
3714 struct UA_Subscription;
3716 
3717 #ifdef UA_ENABLE_SUBSCRIPTIONS
3718 typedef struct UA_PublishResponseEntry {
3719  SIMPLEQ_ENTRY(UA_PublishResponseEntry) listEntry;
3720  UA_UInt32 requestId;
3721  UA_PublishResponse response;
3722 } UA_PublishResponseEntry;
3723 #endif
3724 
3725 struct UA_Session {
3737  LIST_HEAD(ContinuationPointList, ContinuationPointEntry) continuationPoints;
3738 #ifdef UA_ENABLE_SUBSCRIPTIONS
3739  UA_UInt32 lastSubscriptionID;
3740  LIST_HEAD(UA_ListOfUASubscriptions, UA_Subscription) serverSubscriptions;
3741  SIMPLEQ_HEAD(UA_ListOfQueuedPublishResponses, UA_PublishResponseEntry) responseQueue;
3742 #endif
3743 };
3744 
3745 /* Local access to the services (for startup and maintenance) uses this Session
3746  * with all possible access rights (Session ID: 1) */
3747 extern UA_Session adminSession;
3748 
3749 void UA_Session_init(UA_Session *session);
3750 void UA_Session_deleteMembersCleanup(UA_Session *session, UA_Server *server);
3751 
3752 /* If any activity on a session happens, the timeout is extended */
3753 void UA_Session_updateLifetime(UA_Session *session);
3754 
3755 #ifdef UA_ENABLE_SUBSCRIPTIONS
3756 void UA_Session_addSubscription(UA_Session *session, UA_Subscription *newSubscription);
3757 
3759 UA_Session_getSubscriptionByID(UA_Session *session, UA_UInt32 subscriptionID);
3760 
3762 UA_Session_deleteSubscription(UA_Server *server, UA_Session *session,
3763  UA_UInt32 subscriptionID);
3764 
3765 UA_UInt32
3766 UA_Session_getUniqueSubscriptionID(UA_Session *session);
3767 #endif
3768 
3773 #define UA_LOG_TRACE_SESSION(LOGGER, SESSION, MSG, ...) \
3774  UA_LOG_TRACE(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3775  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3776  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3777  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3778  ##__VA_ARGS__);
3779 
3780 #define UA_LOG_DEBUG_SESSION(LOGGER, SESSION, MSG, ...) \
3781  UA_LOG_DEBUG(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3782  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3783  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3784  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3785  ##__VA_ARGS__);
3786 
3787 #define UA_LOG_INFO_SESSION(LOGGER, SESSION, MSG, ...) \
3788  UA_LOG_INFO(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3789  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3790  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3791  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3792  ##__VA_ARGS__);
3793 
3794 #define UA_LOG_WARNING_SESSION(LOGGER, SESSION, MSG, ...) \
3795  UA_LOG_WARNING(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3796  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3797  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3798  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3799  ##__VA_ARGS__);
3800 
3801 #define UA_LOG_ERROR_SESSION(LOGGER, SESSION, MSG, ...) \
3802  UA_LOG_ERROR(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3803  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3804  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3805  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3806  ##__VA_ARGS__);
3807 
3808 #define UA_LOG_FATAL_SESSION(LOGGER, SESSION, MSG, ...) \
3809  UA_LOG_FATAL(LOGGER, UA_LOGCATEGORY_SESSION, "Connection %i | SecureChannel %i | Session " UA_PRINTF_GUID_FORMAT " | " MSG, \
3810  ((SESSION)->channel ? ((SESSION)->channel->connection ? (SESSION)->channel->connection->sockfd : 0) : 0), \
3811  ((SESSION)->channel ? (SESSION)->channel->securityToken.channelId : 0), \
3812  UA_PRINTF_GUID_DATA((SESSION)->sessionId.identifier.guid), \
3813  ##__VA_ARGS__);
3814 
3815 
3816 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_subscription.h" ***********************************/
3817 
3818 /* This Source Code Form is subject to the terms of the Mozilla Public
3819 * License, v. 2.0. If a copy of the MPL was not distributed with this
3820 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3821 
3822 
3823 
3824 /*****************/
3825 /* MonitoredItem */
3826 /*****************/
3827 
3828 typedef enum {
3833 
3836  UA_UInt32 clientHandle;
3837  UA_DataValue value;
3839 
3840 typedef struct UA_MonitoredItem {
3841  LIST_ENTRY(UA_MonitoredItem) listEntry;
3842 
3843  /* Settings */
3844  UA_Subscription *subscription;
3845  UA_UInt32 itemId;
3846  UA_MonitoredItemType monitoredItemType;
3847  UA_TimestampsToReturn timestampsToReturn;
3848  UA_MonitoringMode monitoringMode;
3849  UA_NodeId monitoredNodeId;
3850  UA_UInt32 attributeID;
3851  UA_UInt32 clientHandle;
3852  UA_Double samplingInterval; // [ms]
3853  UA_UInt32 currentQueueSize;
3854  UA_UInt32 maxQueueSize;
3855  UA_Boolean discardOldest;
3856  UA_String indexRange;
3857  // TODO: dataEncoding is hardcoded to UA binary
3858  UA_DataChangeTrigger trigger;
3859 
3860  /* Sample Job */
3861  UA_Guid sampleJobGuid;
3862  UA_Boolean sampleJobIsRegistered;
3863 
3864  /* Sample Queue */
3865  UA_ByteString lastSampledValue;
3866  TAILQ_HEAD(QueueOfQueueDataValues, MonitoredItem_queuedValue) queue;
3868 
3870 void MonitoredItem_delete(UA_Server *server, UA_MonitoredItem *monitoredItem);
3871 void UA_MoniteredItem_SampleCallback(UA_Server *server, UA_MonitoredItem *monitoredItem);
3874 
3875 /****************/
3876 /* Subscription */
3877 /****************/
3878 
3881  UA_NotificationMessage message;
3883 
3884 /* We use only a subset of the states defined in the standard */
3885 typedef enum {
3886  /* UA_SUBSCRIPTIONSTATE_CLOSED */
3887  /* UA_SUBSCRIPTIONSTATE_CREATING */
3892 
3894  LIST_ENTRY(UA_Subscription) listEntry;
3895 
3896  /* Settings */
3897  UA_Session *session;
3898  UA_UInt32 lifeTimeCount;
3899  UA_UInt32 maxKeepAliveCount;
3900  UA_Double publishingInterval; /* in ms */
3901  UA_UInt32 subscriptionID;
3902  UA_UInt32 notificationsPerPublish;
3903  UA_Boolean publishingEnabled;
3904  UA_UInt32 priority;
3905 
3906  /* Runtime information */
3907  UA_SubscriptionState state;
3908  UA_UInt32 sequenceNumber;
3909  UA_UInt32 currentKeepAliveCount;
3910  UA_UInt32 currentLifetimeCount;
3911  UA_UInt32 lastMonitoredItemId;
3912 
3913  /* Publish Job */
3914  UA_Guid publishJobGuid;
3915  UA_Boolean publishJobIsRegistered;
3916 
3917  /* MonitoredItems */
3918  LIST_HEAD(UA_ListOfUAMonitoredItems, UA_MonitoredItem) monitoredItems;
3919 
3920  /* Retransmission Queue */
3921  TAILQ_HEAD(UA_ListOfNotificationMessages, UA_NotificationMessageEntry) retransmissionQueue;
3922  UA_UInt32 retransmissionQueueSize;
3923 };
3924 
3925 UA_Subscription *UA_Subscription_new(UA_Session *session, UA_UInt32 subscriptionID);
3926 void UA_Subscription_deleteMembers(UA_Subscription *subscription, UA_Server *server);
3929 
3932  UA_UInt32 monitoredItemID);
3933 
3936 
3938 
3941 
3942 void
3944  UA_NodeId *sessionToken);
3945 
3946 
3947 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_nodestore.h" ***********************************/
3948 
3949 /* This Source Code Form is subject to the terms of the Mozilla Public
3950 * License, v. 2.0. If a copy of the MPL was not distributed with this
3951 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
3952 
3953 
3954 #ifdef __cplusplus
3955 extern "C" {
3956 #endif
3957 
3958 
3964 struct UA_NodeStore;
3966 
3970 /* Create a new nodestore */
3972 
3973 /* Delete the nodestore and all nodes in it. Do not call from a read-side
3974  critical section (multithreading). */
3976 
3985 /* Create an editable node of the given NodeClass. */
3987 #define UA_NodeStore_newObjectNode() \
3988  (UA_ObjectNode*)UA_NodeStore_newNode(UA_NODECLASS_OBJECT)
3989 #define UA_NodeStore_newVariableNode() \
3990  (UA_VariableNode*)UA_NodeStore_newNode(UA_NODECLASS_VARIABLE)
3991 #define UA_NodeStore_newMethodNode() \
3992  (UA_MethodNode*)UA_NodeStore_newNode(UA_NODECLASS_METHOD)
3993 #define UA_NodeStore_newObjectTypeNode() \
3994  (UA_ObjectTypeNode*)UA_NodeStore_newNode(UA_NODECLASS_OBJECTTYPE)
3995 #define UA_NodeStore_newVariableTypeNode() \
3996  (UA_VariableTypeNode*)UA_NodeStore_newNode(UA_NODECLASS_VARIABLETYPE)
3997 #define UA_NodeStore_newReferenceTypeNode() \
3998  (UA_ReferenceTypeNode*)UA_NodeStore_newNode(UA_NODECLASS_REFERENCETYPE)
3999 #define UA_NodeStore_newDataTypeNode() \
4000  (UA_DataTypeNode*)UA_NodeStore_newNode(UA_NODECLASS_DATATYPE)
4001 #define UA_NodeStore_newViewNode() \
4002  (UA_ViewNode*)UA_NodeStore_newNode(UA_NODECLASS_VIEW)
4003 
4004 /* Delete an editable node. */
4005 void UA_NodeStore_deleteNode(UA_Node *node);
4006 
4010 /* Inserts a new node into the nodestore. If the nodeid is zero, then a fresh
4011  * numeric nodeid from namespace 1 is assigned. If insertion fails, the node is
4012  * deleted. */
4014 
4015 /* The returned node is immutable. */
4016 const UA_Node * UA_NodeStore_get(UA_NodeStore *ns, const UA_NodeId *nodeid);
4017 
4018 /* Returns an editable copy of a node (needs to be deleted with the deleteNode
4019  function or inserted / replaced into the nodestore). */
4020 UA_Node * UA_NodeStore_getCopy(UA_NodeStore *ns, const UA_NodeId *nodeid);
4021 
4022 /* To replace a node, get an editable copy of the node, edit and replace with
4023  * this function. If the node was already replaced since the copy was made,
4024  * UA_STATUSCODE_BADINTERNALERROR is returned. If the nodeid is not found,
4025  * UA_STATUSCODE_BADNODEIDUNKNOWN is returned. In both error cases, the editable
4026  * node is deleted. */
4028 
4029 /* Remove a node in the nodestore. */
4031 
4037 typedef void (*UA_NodeStore_nodeVisitor)(const UA_Node *node);
4039 
4040 #ifdef __cplusplus
4041 } // extern "C"
4042 #endif
4043 
4044 
4045 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_session_manager.h" ***********************************/
4046 
4047 /* This Source Code Form is subject to the terms of the Mozilla Public
4048 * License, v. 2.0. If a copy of the MPL was not distributed with this
4049 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4050 
4051 
4052 
4053 typedef struct session_list_entry {
4054  LIST_ENTRY(session_list_entry) pointers;
4055  UA_Session session;
4057 
4058 typedef struct UA_SessionManager {
4059  LIST_HEAD(session_list, session_list_entry) sessions; // doubly-linked list of sessions
4060  UA_UInt32 currentSessionCount;
4061  UA_Server *server;
4063 
4066 
4067 /* Deletes all sessions */
4069 
4070 /* Deletes all sessions that have timed out. Deletion is implemented via a
4071  * delayed callback. So all currently scheduled jobs with a pointer to the
4072  * session can complete. */
4074  UA_DateTime nowMonotonic);
4075 
4078  const UA_CreateSessionRequest *request, UA_Session **session);
4079 
4082 
4083 UA_Session *
4085 
4086 
4087 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_securechannel_manager.h" ***********************************/
4088 
4089 /* This Source Code Form is subject to the terms of the Mozilla Public
4090 * License, v. 2.0. If a copy of the MPL was not distributed with this
4091 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4092 
4093 
4094 
4095 typedef struct channel_list_entry {
4097  LIST_ENTRY(channel_list_entry) pointers;
4099 
4100 typedef struct UA_SecureChannelManager {
4101  LIST_HEAD(channel_list, channel_list_entry) channels; // doubly-linked list of channels
4102  UA_UInt32 currentChannelCount;
4103  UA_UInt32 lastChannelId;
4104  UA_UInt32 lastTokenId;
4105  UA_Server *server;
4107 
4110 
4111 /* Remove a all securechannels */
4112 void
4114 
4115 /* Remove timed out securechannels with a delayed callback. So all currently
4116  * scheduled jobs with a pointer to a securechannel can finish first. */
4117 void
4119  UA_DateTime nowMonotonic);
4120 
4123  const UA_OpenSecureChannelRequest *request,
4124  UA_OpenSecureChannelResponse *response);
4125 
4128  const UA_OpenSecureChannelRequest *request,
4129  UA_OpenSecureChannelResponse *response);
4130 
4133 
4136 
4137 
4138 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_server_internal.h" ***********************************/
4139 
4140 /* This Source Code Form is subject to the terms of the Mozilla Public
4141 * License, v. 2.0. If a copy of the MPL was not distributed with this
4142 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4143 
4144 
4145 
4146 #define ANONYMOUS_POLICY "open62541-anonymous-policy"
4147 #define USERNAME_POLICY "open62541-username-policy"
4148 
4149 /* The general idea of RCU is to delay freeing nodes (or any callback invoked
4150  * with call_rcu) until all threads have left their critical section. Thus we
4151  * can delete nodes safely in concurrent operations. The macros UA_RCU_LOCK and
4152  * UA_RCU_UNLOCK are used to test during debugging that we do not nest read-side
4153  * critical sections (although this is generally allowed). */
4154 #ifdef UA_ENABLE_MULTITHREADING
4155 # define _LGPL_SOURCE
4156 # include <urcu.h>
4157 # include <urcu/lfstack.h>
4158 # ifdef NDEBUG
4159 # define UA_RCU_LOCK() rcu_read_lock()
4160 # define UA_RCU_UNLOCK() rcu_read_unlock()
4161 # define UA_ASSERT_RCU_LOCKED()
4162 # define UA_ASSERT_RCU_UNLOCKED()
4163 # else
4164  extern UA_THREAD_LOCAL bool rcu_locked;
4165 # define UA_ASSERT_RCU_LOCKED() assert(rcu_locked)
4166 # define UA_ASSERT_RCU_UNLOCKED() assert(!rcu_locked)
4167 # define UA_RCU_LOCK() do { \
4168  UA_ASSERT_RCU_UNLOCKED(); \
4169  rcu_locked = true; \
4170  rcu_read_lock(); } while(0)
4171 # define UA_RCU_UNLOCK() do { \
4172  UA_ASSERT_RCU_LOCKED(); \
4173  rcu_locked = false; \
4174  rcu_read_unlock(); } while(0)
4175 # endif
4176 #else
4177 # define UA_RCU_LOCK()
4178 # define UA_RCU_UNLOCK()
4179 # define UA_ASSERT_RCU_LOCKED()
4180 # define UA_ASSERT_RCU_UNLOCKED()
4181 #endif
4182 
4183 
4184 #ifdef UA_ENABLE_MULTITHREADING
4185 typedef struct {
4186  UA_Server *server;
4187  pthread_t thr;
4188  UA_UInt32 counter;
4189  volatile UA_Boolean running;
4190  char padding[64 - sizeof(void*) - sizeof(pthread_t) -
4191  sizeof(UA_UInt32) - sizeof(UA_Boolean)]; // separate cache lines
4192 } UA_Worker;
4193 #endif
4194 
4195 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
4196 /* Internally used context to a session 'context' of the current mehtod call */
4197 extern UA_THREAD_LOCAL UA_Session* methodCallSession;
4198 #endif
4199 
4200 struct UA_Server {
4201  /* Meta */
4205 
4206  /* Security */
4209 
4210  /* Address Space */
4212 
4215 
4216 
4217  /* Jobs with a repetition interval */
4218  LIST_HEAD(RepeatedJobsList, RepeatedJob) repeatedJobs;
4219 
4220 #ifndef UA_ENABLE_MULTITHREADING
4221  SLIST_HEAD(DelayedJobsList, UA_DelayedJob) delayedCallbacks;
4222 #else
4223  /* Dispatch queue head for the worker threads (the tail should not be in the same cache line) */
4224  struct cds_wfcq_head dispatchQueue_head;
4225  UA_Worker *workers; /* there are nThread workers in a running server */
4226  struct cds_lfs_stack mainLoopJobs; /* Work that shall be executed only in the main loop and not
4227  by worker threads */
4228  struct DelayedJobs *delayedJobs;
4229  pthread_cond_t dispatchQueue_condition; /* so the workers don't spin if the queue is empty */
4230  pthread_mutex_t dispatchQueue_mutex; /* mutex for access to condition variable */
4231  struct cds_wfcq_tail dispatchQueue_tail; /* Dispatch queue tail for the worker threads */
4232 #endif
4233 
4234  /* Config is the last element so that MSVC allows the usernamePasswordLogins
4235  field with zero-sized array */
4236  UA_ServerConfig config;
4237 };
4238 
4239 /*****************/
4240 /* Node Handling */
4241 /*****************/
4242 
4245 
4246 /* Calls callback on the node. In the multithreaded case, the node is copied before and replaced in
4247  the nodestore. */
4249 UA_StatusCode UA_Server_editNode(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId,
4250  UA_EditNodeCallback callback, const void *data);
4251 
4252 /********************/
4253 /* Event Processing */
4254 /********************/
4255 
4256 void UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection,
4257  const UA_ByteString *message);
4258 
4259 UA_StatusCode UA_Server_delayedCallback(UA_Server *server, UA_ServerCallback callback, void *data);
4260 UA_StatusCode UA_Server_delayedFree(UA_Server *server, void *data);
4261 void UA_Server_deleteAllRepeatedJobs(UA_Server *server);
4262 
4263 /* Add an existing node. The node is assumed to be "finished", i.e. no
4264  * instantiation from inheritance is necessary. Instantiationcallback and
4265  * addedNodeId may be NULL. */
4267 Service_AddNodes_existing(UA_Server *server, UA_Session *session, UA_Node *node,
4268  const UA_NodeId *parentNodeId,
4269  const UA_NodeId *referenceTypeId,
4270  const UA_NodeId *typeDefinition,
4271  UA_InstantiationCallback *instantiationCallback,
4272  UA_NodeId *addedNodeId);
4273 
4274 /*********************/
4275 /* Utility Functions */
4276 /*********************/
4277 
4279 parse_numericrange(const UA_String *str, UA_NumericRange *range);
4280 
4281 UA_UInt16 addNamespace(UA_Server *server, const UA_String name);
4282 
4283 UA_Boolean
4284 UA_Node_hasSubTypeOrInstances(const UA_Node *node);
4285 
4286 const UA_VariableTypeNode *
4287 getVariableNodeType(UA_Server *server, const UA_VariableNode *node);
4288 
4289 const UA_ObjectTypeNode *
4290 getObjectNodeType(UA_Server *server, const UA_ObjectNode *node);
4291 
4292 /* Returns an array with all subtype nodeids (including the root). Subtypes need
4293  * to have the same nodeClass as root and are (recursively) related with a
4294  * hasSubType reference. Since multi-inheritance is possible, we test for
4295  * duplicates and return evey nodeid at most once. */
4297 getTypeHierarchy(UA_NodeStore *ns, const UA_Node *rootRef, UA_Boolean inverse,
4298  UA_NodeId **typeHierarchy, size_t *typeHierarchySize);
4299 
4300 /* Recursively searches "upwards" in the tree following specific reference types */
4301 UA_Boolean
4302 isNodeInTree(UA_NodeStore *ns, const UA_NodeId *leafNode,
4303  const UA_NodeId *nodeToFind, const UA_NodeId *referenceTypeIds,
4304  size_t referenceTypeIdsSize);
4305 
4306 const UA_Node *
4307 getNodeType(UA_Server *server, const UA_Node *node);
4308 
4309 /***************************************/
4310 /* Check Information Model Consistency */
4311 /***************************************/
4312 
4314 readValueAttribute(UA_Server *server, const UA_VariableNode *vn, UA_DataValue *v);
4315 
4317 typeCheckValue(UA_Server *server, const UA_NodeId *targetDataTypeId,
4318  UA_Int32 targetValueRank, size_t targetArrayDimensionsSize,
4319  const UA_UInt32 *targetArrayDimensions, const UA_Variant *value,
4320  const UA_NumericRange *range, UA_Variant *editableValue);
4321 
4323 writeDataTypeAttribute(UA_Server *server, UA_VariableNode *node,
4324  const UA_NodeId *dataType, const UA_NodeId *constraintDataType);
4325 
4327 compatibleArrayDimensions(size_t constraintArrayDimensionsSize,
4328  const UA_UInt32 *constraintArrayDimensions,
4329  size_t testArrayDimensionsSize,
4330  const UA_UInt32 *testArrayDimensions);
4331 
4333 writeValueRankAttribute(UA_Server *server, UA_VariableNode *node, UA_Int32 valueRank,
4334  UA_Int32 constraintValueRank);
4335 
4337 writeValueAttribute(UA_Server *server, UA_VariableNode *node,
4338  const UA_DataValue *value, const UA_String *indexRange);
4339 
4340 /*******************/
4341 /* Single-Services */
4342 /*******************/
4343 
4344 /* Some services take an array of "independent" requests. The single-services
4345  are stored here to keep ua_services.h clean for documentation purposes. */
4346 
4347 void Service_Browse_single(UA_Server *server, UA_Session *session,
4348  struct ContinuationPointEntry *cp,
4349  const UA_BrowseDescription *descr,
4350  UA_UInt32 maxrefs, UA_BrowseResult *result);
4351 
4352 void Service_Read_single(UA_Server *server, UA_Session *session,
4353  UA_TimestampsToReturn timestamps,
4354  const UA_ReadValueId *id, UA_DataValue *v);
4355 
4356 void Service_Call_single(UA_Server *server, UA_Session *session,
4357  const UA_CallMethodRequest *request,
4358  UA_CallMethodResult *result);
4359 
4360 
4361 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services.h" ***********************************/
4362 
4363 /* This Source Code Form is subject to the terms of the Mozilla Public
4364 * License, v. 2.0. If a copy of the MPL was not distributed with this
4365 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4366 
4367 
4368 #ifdef __cplusplus
4369 extern "C" {
4370 #endif
4371 
4372 
4391 /* Most services take as input the server, the current session and pointers to
4392  * the request and response structures. Possible error codes are returned as
4393  * part of the response. */
4394 typedef void (*UA_Service)(UA_Server*, UA_Session*,
4395  const void *request, void *response);
4396 
4402 void Service_FindServers(UA_Server *server, UA_Session *session,
4403  const UA_FindServersRequest *request,
4404  UA_FindServersResponse *response);
4405 
4406 /* Returns the Endpoints supported by a Server and all of the configuration
4407  * information required to establish a SecureChannel and a Session. */
4408 void Service_GetEndpoints(UA_Server *server, UA_Session *session,
4409  const UA_GetEndpointsRequest *request,
4410  UA_GetEndpointsResponse *response);
4411 
4412 /* Not Implemented: Service_RegisterServer */
4413 
4420 /* Open or renew a SecureChannel that can be used to ensure Confidentiality and
4421  * Integrity for Message exchange during a Session. */
4422 void Service_OpenSecureChannel(UA_Server *server, UA_Connection *connection,
4423  const UA_OpenSecureChannelRequest *request,
4424  UA_OpenSecureChannelResponse *response);
4425 
4426 /* Used to terminate a SecureChannel. */
4427 void Service_CloseSecureChannel(UA_Server *server, UA_SecureChannel *channel);
4428 
4434 /* Used by an OPC UA Client to create a Session and the Server returns two
4435  * values which uniquely identify the Session. The first value is the sessionId
4436  * which is used to identify the Session in the audit logs and in the Server's
4437  * address space. The second is the authenticationToken which is used to
4438  * associate an incoming request with a Session. */
4439 void Service_CreateSession(UA_Server *server, UA_SecureChannel *channel,
4440  const UA_CreateSessionRequest *request,
4441  UA_CreateSessionResponse *response);
4442 
4443 /* Used by the Client to submit its SoftwareCertificates to the Server for
4444  * validation and to specify the identity of the user associated with the
4445  * Session. This Service request shall be issued by the Client before it issues
4446  * any other Service request after CreateSession. Failure to do so shall cause
4447  * the Server to close the Session. */
4448 void Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel,
4449  UA_Session *session,
4450  const UA_ActivateSessionRequest *request,
4451  UA_ActivateSessionResponse *response);
4452 
4453 /* Used to terminate a Session. */
4454 void Service_CloseSession(UA_Server *server, UA_Session *session,
4455  const UA_CloseSessionRequest *request,
4456  UA_CloseSessionResponse *response);
4457 
4458 /* Not Implemented: Service_Cancel */
4459 
4467 /* Used to add one or more Nodes into the AddressSpace hierarchy. */
4468 void Service_AddNodes(UA_Server *server, UA_Session *session,
4469  const UA_AddNodesRequest *request,
4470  UA_AddNodesResponse *response);
4471 
4472 /* Used to add one or more References to one or more Nodes. */
4473 void Service_AddReferences(UA_Server *server, UA_Session *session,
4474  const UA_AddReferencesRequest *request,
4475  UA_AddReferencesResponse *response);
4476 
4477 /* Used to delete one or more Nodes from the AddressSpace. */
4478 void Service_DeleteNodes(UA_Server *server, UA_Session *session,
4479  const UA_DeleteNodesRequest *request,
4480  UA_DeleteNodesResponse *response);
4481 
4482 /* Used to delete one or more References of a Node. */
4483 void Service_DeleteReferences(UA_Server *server, UA_Session *session,
4484  const UA_DeleteReferencesRequest *request,
4485  UA_DeleteReferencesResponse *response);
4486 
4494 /* Used to discover the References of a specified Node. The browse can be
4495  * further limited by the use of a View. This Browse Service also supports a
4496  * primitive filtering capability. */
4497 void Service_Browse(UA_Server *server, UA_Session *session,
4498  const UA_BrowseRequest *request,
4499  UA_BrowseResponse *response);
4500 
4501 /* Used to request the next set of Browse or BrowseNext response information
4502  * that is too large to be sent in a single response. "Too large" in this
4503  * context means that the Server is not able to return a larger response or that
4504  * the number of results to return exceeds the maximum number of results to
4505  * return that was specified by the Client in the original Browse request. */
4506 void Service_BrowseNext(UA_Server *server, UA_Session *session,
4507  const UA_BrowseNextRequest *request,
4508  UA_BrowseNextResponse *response);
4509 
4510 /* Used to translate textual node paths to their respective ids. */
4511 void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *session,
4514 
4515 /* Used by Clients to register the Nodes that they know they will access
4516  * repeatedly (e.g. Write, Call). It allows Servers to set up anything needed so
4517  * that the access operations will be more efficient. */
4518 void Service_RegisterNodes(UA_Server *server, UA_Session *session,
4519  const UA_RegisterNodesRequest *request,
4520  UA_RegisterNodesResponse *response);
4521 
4522 /* This Service is used to unregister NodeIds that have been obtained via the
4523  * RegisterNodes service. */
4524 void Service_UnregisterNodes(UA_Server *server, UA_Session *session,
4525  const UA_UnregisterNodesRequest *request,
4526  UA_UnregisterNodesResponse *response);
4527 
4538 /* Not Implemented: Service_QueryFirst */
4539 /* Not Impelemented: Service_QueryNext */
4540 
4546 /* Used to read one or more Attributes of one or more Nodes. For constructed
4547  * Attribute values whose elements are indexed, such as an array, this Service
4548  * allows Clients to read the entire set of indexed values as a composite, to
4549  * read individual elements or to read ranges of elements of the composite. */
4550 void Service_Read(UA_Server *server, UA_Session *session,
4551  const UA_ReadRequest *request,
4552  UA_ReadResponse *response);
4553 
4554 /* Used to write one or more Attributes of one or more Nodes. For constructed
4555  * Attribute values whose elements are indexed, such as an array, this Service
4556  * allows Clients to write the entire set of indexed values as a composite, to
4557  * write individual elements or to write ranges of elements of the composite. */
4558 void Service_Write(UA_Server *server, UA_Session *session,
4559  const UA_WriteRequest *request,
4560  UA_WriteResponse *response);
4561 
4562 /* Not Implemented: Service_HistoryRead */
4563 /* Not Implemented: Service_HistoryUpdate */
4564 
4573 /* Used to call (invoke) a list of Methods. Each method call is invoked within
4574  * the context of an existing Session. If the Session is terminated, the results
4575  * of the method's execution cannot be returned to the Client and are
4576  * discarded. */
4577 void Service_Call(UA_Server *server, UA_Session *session,
4578  const UA_CallRequest *request,
4579  UA_CallResponse *response);
4580 
4587 /* Used to create and add one or more MonitoredItems to a Subscription. A
4588  * MonitoredItem is deleted automatically by the Server when the Subscription is
4589  * deleted. Deleting a MonitoredItem causes its entire set of triggered item
4590  * links to be deleted, but has no effect on the MonitoredItems referenced by
4591  * the triggered items. */
4592 void Service_CreateMonitoredItems(UA_Server *server, UA_Session *session,
4593  const UA_CreateMonitoredItemsRequest *request,
4595 
4596 /* Used to remove one or more MonitoredItems of a Subscription. When a
4597  * MonitoredItem is deleted, its triggered item links are also deleted. */
4598 void Service_DeleteMonitoredItems(UA_Server *server, UA_Session *session,
4599  const UA_DeleteMonitoredItemsRequest *request,
4601 
4602 void Service_ModifyMonitoredItems(UA_Server *server, UA_Session *session,
4603  const UA_ModifyMonitoredItemsRequest *request,
4605 
4606 /* Used to set the monitoring mode for one or more MonitoredItems of a
4607  Subscription. */
4608 void Service_SetMonitoringMode(UA_Server *server, UA_Session *session,
4609  const UA_SetMonitoringModeRequest *request,
4610  UA_SetMonitoringModeResponse *response);
4611 
4612 /* Not Implemented: Service_SetTriggering */
4613 
4618 /* Used to create a Subscription. Subscriptions monitor a set of MonitoredItems
4619  * for Notifications and return them to the Client in response to Publish
4620  * requests. */
4621 void Service_CreateSubscription(UA_Server *server, UA_Session *session,
4622  const UA_CreateSubscriptionRequest *request,
4623  UA_CreateSubscriptionResponse *response);
4624 
4625 /* Used to modify a Subscription. */
4626 void Service_ModifySubscription(UA_Server *server, UA_Session *session,
4627  const UA_ModifySubscriptionRequest *request,
4628  UA_ModifySubscriptionResponse *response);
4629 
4630 /* Used to enable sending of Notifications on one or more Subscriptions. */
4631 void Service_SetPublishingMode(UA_Server *server, UA_Session *session,
4632  const UA_SetPublishingModeRequest *request,
4633  UA_SetPublishingModeResponse *response);
4634 
4635 /* Used for two purposes. First, it is used to acknowledge the receipt of
4636  * NotificationMessages for one or more Subscriptions. Second, it is used to
4637  * request the Server to return a NotificationMessage or a keep-alive
4638  * Message.
4639  *
4640  * Note that the service signature is an exception and does not contain a
4641  * pointer to a PublishResponse. That is because the service queues up publish
4642  * requests internally and sends responses asynchronously based on timeouts. */
4643 void Service_Publish(UA_Server *server, UA_Session *session,
4644  const UA_PublishRequest *request, UA_UInt32 requestId);
4645 
4646 /* Requests the Subscription to republish a NotificationMessage from its
4647  * retransmission queue. */
4648 void Service_Republish(UA_Server *server, UA_Session *session,
4649  const UA_RepublishRequest *request,
4650  UA_RepublishResponse *response);
4651 
4652 /* Invoked to delete one or more Subscriptions that belong to the Client's
4653  * Session. */
4654 void Service_DeleteSubscriptions(UA_Server *server, UA_Session *session,
4655  const UA_DeleteSubscriptionsRequest *request,
4656  UA_DeleteSubscriptionsResponse *response);
4657 
4658 /* Not Implemented: Service_TransferSubscription */
4659 
4660 #ifdef __cplusplus
4661 } // extern "C"
4662 #endif
4663 
4664 
4665 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/client/ua_client_internal.h" ***********************************/
4666 
4667 /* This Source Code Form is subject to the terms of the Mozilla Public
4668 * License, v. 2.0. If a copy of the MPL was not distributed with this
4669 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4670 
4671 
4672 
4673 /**************************/
4674 /* Subscriptions Handling */
4675 /**************************/
4676 
4677 #ifdef UA_ENABLE_SUBSCRIPTIONS
4678 
4679 typedef struct UA_Client_NotificationsAckNumber {
4680  LIST_ENTRY(UA_Client_NotificationsAckNumber) listEntry;
4682 } UA_Client_NotificationsAckNumber;
4683 
4684 typedef struct UA_Client_MonitoredItem {
4685  LIST_ENTRY(UA_Client_MonitoredItem) listEntry;
4686  UA_UInt32 monitoredItemId;
4687  UA_UInt32 monitoringMode;
4688  UA_NodeId monitoredNodeId;
4689  UA_UInt32 attributeID;
4690  UA_UInt32 clientHandle;
4691  UA_Double samplingInterval;
4692  UA_UInt32 queueSize;
4693  UA_Boolean discardOldest;
4694  void (*handler)(UA_UInt32 monId, UA_DataValue *value, void *context);
4695  void *handlerContext;
4696 } UA_Client_MonitoredItem;
4697 
4698 typedef struct UA_Client_Subscription {
4699  LIST_ENTRY(UA_Client_Subscription) listEntry;
4700  UA_UInt32 lifeTime;
4701  UA_UInt32 keepAliveCount;
4702  UA_Double publishingInterval;
4703  UA_UInt32 subscriptionID;
4704  UA_UInt32 notificationsPerPublish;
4705  UA_UInt32 priority;
4706  LIST_HEAD(UA_ListOfClientMonitoredItems, UA_Client_MonitoredItem) monitoredItems;
4707 } UA_Client_Subscription;
4708 
4709 void UA_Client_Subscriptions_forceDelete(UA_Client *client, UA_Client_Subscription *sub);
4710 
4711 #endif
4712 
4713 /**********/
4714 /* Client */
4715 /**********/
4716 
4717 typedef enum {
4721 
4722 struct UA_Client {
4723  /* State */
4724  UA_ClientState state;
4725  UA_ClientConfig config;
4726 
4727  /* Connection */
4730 
4731  /* SecureChannel */
4735 
4736  /* Authentication */
4737  UA_Client_Authentication authenticationMethod;
4740 
4741  /* Session */
4745 
4746  /* Subscriptions */
4747 #ifdef UA_ENABLE_SUBSCRIPTIONS
4748  UA_UInt32 monitoredItemHandles;
4749  LIST_HEAD(ListOfUnacknowledgedNotifications, UA_Client_NotificationsAckNumber) pendingNotificationsAcks;
4750  LIST_HEAD(ListOfClientSubscriptionItems, UA_Client_Subscription) subscriptions;
4751 #endif
4752 };
4753 
4754 
4755 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_types.c" ***********************************/
4756 
4757 /* This Source Code Form is subject to the terms of the Mozilla Public
4758 * License, v. 2.0. If a copy of the MPL was not distributed with this
4759 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
4760 
4761 
4762 
4763 /* Datatype Handling
4764  * -----------------
4765  * This file contains handling functions for the builtin types and functions
4766  * handling of structured types and arrays. These need type descriptions in a
4767  * UA_DataType structure. The UA_DataType structures as well as all non-builtin
4768  * datatypes are autogenerated. */
4769 
4770 /* Global definition of NULL type instances. These are always zeroed out, as
4771  * mandated by the C/C++ standard for global values with no initializer. */
4777 
4778 /* TODO: The standard-defined types are ordered. See if binary search is more
4779  * efficient. */
4780 const UA_DataType *
4781 UA_findDataType(const UA_NodeId *typeId) {
4782  for(size_t i = 0; i < UA_TYPES_COUNT; ++i) {
4783  if(UA_TYPES[i].typeId.identifier.numeric == typeId->identifier.numeric)
4784  return &UA_TYPES[i];
4785  }
4786  return NULL;
4787 }
4788 
4789 /***************************/
4790 /* Random Number Generator */
4791 /***************************/
4792 
4794 
4795 void
4797  pcg32_srandom_r(&UA_rng, seed, (uint64_t)UA_DateTime_now());
4798 }
4799 
4800 UA_UInt32
4802  return (UA_UInt32)pcg32_random_r(&UA_rng);
4803 }
4804 
4805 /*****************/
4806 /* Builtin Types */
4807 /*****************/
4808 
4809 static void deleteMembers_noInit(void *p, const UA_DataType *type);
4810 static UA_StatusCode copy_noInit(const void *src, void *dst, const UA_DataType *type);
4811 
4812 UA_String
4813 UA_String_fromChars(char const src[]) {
4814  UA_String str = UA_STRING_NULL;
4815  size_t length = strlen(src);
4816  if(length > 0) {
4817  str.data = (UA_Byte*)UA_malloc(length);
4818  if(!str.data)
4819  return str;
4820  } else {
4822  }
4823  memcpy(str.data, src, length);
4824  str.length = length;
4825  return str;
4826 }
4827 
4828 UA_Boolean
4829 UA_String_equal(const UA_String *s1, const UA_String *s2) {
4830  if(s1->length != s2->length)
4831  return false;
4832  UA_Int32 is = memcmp((char const*)s1->data,
4833  (char const*)s2->data, s1->length);
4834  return (is == 0) ? true : false;
4835 }
4836 
4837 static void
4838 String_deleteMembers(UA_String *s, const UA_DataType *_) {
4839  UA_free((void*)((uintptr_t)s->data & ~(uintptr_t)UA_EMPTY_ARRAY_SENTINEL));
4840 }
4841 
4842 /* DateTime */
4845  /* Calculating the the milli-, micro- and nanoseconds */
4846  UA_DateTimeStruct dateTimeStruct;
4847  dateTimeStruct.nanoSec = (UA_UInt16)((t % 10) * 100);
4848  dateTimeStruct.microSec = (UA_UInt16)((t % 10000) / 10);
4849  dateTimeStruct.milliSec = (UA_UInt16)((t % 10000000) / 10000);
4850 
4851  /* Calculating the unix time with #include <time.h> */
4852  time_t secSinceUnixEpoch =
4853  (time_t)((t - UA_DATETIME_UNIX_EPOCH) / UA_SEC_TO_DATETIME);
4854  struct tm ts;
4855  memset(&ts, 0, sizeof(struct tm));
4856  __secs_to_tm(secSinceUnixEpoch, &ts);
4857  dateTimeStruct.sec = (UA_UInt16)ts.tm_sec;
4858  dateTimeStruct.min = (UA_UInt16)ts.tm_min;
4859  dateTimeStruct.hour = (UA_UInt16)ts.tm_hour;
4860  dateTimeStruct.day = (UA_UInt16)ts.tm_mday;
4861  dateTimeStruct.month = (UA_UInt16)(ts.tm_mon + 1);
4862  dateTimeStruct.year = (UA_UInt16)(ts.tm_year + 1900);
4863  return dateTimeStruct;
4864 }
4865 
4866 static void
4867 printNumber(UA_UInt16 n, UA_Byte *pos, size_t digits) {
4868  for(size_t i = digits; i > 0; --i) {
4869  pos[i-1] = (UA_Byte)((n % 10) + '0');
4870  n = n / 10;
4871  }
4872 }
4873 
4874 UA_String
4876  UA_String str = UA_STRING_NULL;
4877  // length of the string is 31 (plus \0 at the end)
4878  if(!(str.data = (UA_Byte*)UA_malloc(32)))
4879  return str;
4880  str.length = 31;
4882  printNumber(tSt.month, str.data, 2);
4883  str.data[2] = '/';
4884  printNumber(tSt.day, &str.data[3], 2);
4885  str.data[5] = '/';
4886  printNumber(tSt.year, &str.data[6], 4);
4887  str.data[10] = ' ';
4888  printNumber(tSt.hour, &str.data[11], 2);
4889  str.data[13] = ':';
4890  printNumber(tSt.min, &str.data[14], 2);
4891  str.data[16] = ':';
4892  printNumber(tSt.sec, &str.data[17], 2);
4893  str.data[19] = '.';
4894  printNumber(tSt.milliSec, &str.data[20], 3);
4895  str.data[23] = '.';
4896  printNumber(tSt.microSec, &str.data[24], 3);
4897  str.data[27] = '.';
4898  printNumber(tSt.nanoSec, &str.data[28], 3);
4899  return str;
4900 }
4901 
4902 /* Guid */
4903 UA_Boolean
4904 UA_Guid_equal(const UA_Guid *g1, const UA_Guid *g2) {
4905  if(memcmp(g1, g2, sizeof(UA_Guid)) == 0)
4906  return true;
4907  return false;
4908 }
4909 
4910 UA_Guid
4912  UA_Guid result;
4913  result.data1 = (UA_UInt32)pcg32_random_r(&UA_rng);
4914  UA_UInt32 r = (UA_UInt32)pcg32_random_r(&UA_rng);
4915  result.data2 = (UA_UInt16) r;
4916  result.data3 = (UA_UInt16) (r >> 16);
4917  r = (UA_UInt32)pcg32_random_r(&UA_rng);
4918  result.data4[0] = (UA_Byte)r;
4919  result.data4[1] = (UA_Byte)(r >> 4);
4920  result.data4[2] = (UA_Byte)(r >> 8);
4921  result.data4[3] = (UA_Byte)(r >> 12);
4922  r = (UA_UInt32)pcg32_random_r(&UA_rng);
4923  result.data4[4] = (UA_Byte)r;
4924  result.data4[5] = (UA_Byte)(r >> 4);
4925  result.data4[6] = (UA_Byte)(r >> 8);
4926  result.data4[7] = (UA_Byte)(r >> 12);
4927  return result;
4928 }
4929 
4930 /* ByteString */
4933  UA_ByteString_init(bs);
4934  if(length == 0)
4935  return UA_STATUSCODE_GOOD;
4936  if(!(bs->data = (UA_Byte*)UA_malloc(length)))
4938  bs->length = length;
4939  return UA_STATUSCODE_GOOD;
4940 }
4941 
4942 /* NodeId */
4943 static void
4944 NodeId_deleteMembers(UA_NodeId *p, const UA_DataType *_) {
4945  switch(p->identifierType) {
4946  case UA_NODEIDTYPE_STRING:
4948  String_deleteMembers(&p->identifier.string, NULL);
4949  break;
4950  default: break;
4951  }
4952 }
4953 
4954 static UA_StatusCode
4955 NodeId_copy(UA_NodeId const *src, UA_NodeId *dst, const UA_DataType *_) {
4957  switch(src->identifierType) {
4958  case UA_NODEIDTYPE_NUMERIC:
4959  *dst = *src;
4960  return UA_STATUSCODE_GOOD;
4961  case UA_NODEIDTYPE_STRING:
4962  retval |= UA_String_copy(&src->identifier.string,
4963  &dst->identifier.string);
4964  break;
4965  case UA_NODEIDTYPE_GUID:
4966  retval |= UA_Guid_copy(&src->identifier.guid, &dst->identifier.guid);
4967  break;
4969  retval |= UA_ByteString_copy(&src->identifier.byteString,
4970  &dst->identifier.byteString);
4971  break;
4972  default:
4974  }
4975  dst->namespaceIndex = src->namespaceIndex;
4976  dst->identifierType = src->identifierType;
4977  return retval;
4978 }
4979 
4980 UA_Boolean
4982  if(p->namespaceIndex != 0)
4983  return false;
4984  switch(p->identifierType) {
4985  case UA_NODEIDTYPE_NUMERIC:
4986  return (p->identifier.numeric == 0);
4987  case UA_NODEIDTYPE_GUID:
4988  return (p->identifier.guid.data1 == 0 &&
4989  p->identifier.guid.data2 == 0 &&
4990  p->identifier.guid.data3 == 0 &&
4991  p->identifier.guid.data4[0] == 0 &&
4992  p->identifier.guid.data4[1] == 0 &&
4993  p->identifier.guid.data4[2] == 0 &&
4994  p->identifier.guid.data4[3] == 0 &&
4995  p->identifier.guid.data4[4] == 0 &&
4996  p->identifier.guid.data4[5] == 0 &&
4997  p->identifier.guid.data4[6] == 0 &&
4998  p->identifier.guid.data4[7] == 0);
4999  default:
5000  break;
5001  }
5002  return (p->identifier.string.length == 0);
5003 }
5004 
5005 UA_Boolean
5006 UA_NodeId_equal(const UA_NodeId *n1, const UA_NodeId *n2) {
5007  if(n1->namespaceIndex != n2->namespaceIndex ||
5008  n1->identifierType!=n2->identifierType)
5009  return false;
5010  switch(n1->identifierType) {
5011  case UA_NODEIDTYPE_NUMERIC:
5012  if(n1->identifier.numeric == n2->identifier.numeric)
5013  return true;
5014  else
5015  return false;
5016  case UA_NODEIDTYPE_STRING:
5017  return UA_String_equal(&n1->identifier.string,
5018  &n2->identifier.string);
5019  case UA_NODEIDTYPE_GUID:
5020  return UA_Guid_equal(&n1->identifier.guid,
5021  &n2->identifier.guid);
5023  return UA_ByteString_equal(&n1->identifier.byteString,
5024  &n2->identifier.byteString);
5025  }
5026  return false;
5027 }
5028 
5029 /* FNV non-cryptographic hash function. See
5030  * https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function */
5031 #define FNV_PRIME_32 16777619
5032 static UA_UInt32
5033 fnv32(UA_UInt32 fnv, const UA_Byte *buf, size_t size) {
5034  for(size_t i = 0; i < size; ++i) {
5035  fnv = fnv ^ (buf[i]);
5036  fnv = fnv * FNV_PRIME_32;
5037  }
5038  return fnv;
5039 }
5040 
5041 UA_UInt32
5043  switch(n->identifierType) {
5044  case UA_NODEIDTYPE_NUMERIC:
5045  default:
5046  return (UA_UInt32)(n->namespaceIndex + (n->identifier.numeric * 2654435761)); /* Knuth's multiplicative hashing */
5047  case UA_NODEIDTYPE_STRING:
5049  return fnv32(n->namespaceIndex, n->identifier.string.data, n->identifier.string.length);
5050  case UA_NODEIDTYPE_GUID:
5051  return fnv32(n->namespaceIndex, (const UA_Byte*)&n->identifier.guid, sizeof(UA_Guid));
5052  }
5053 }
5054 
5055 /* ExpandedNodeId */
5056 static void
5057 ExpandedNodeId_deleteMembers(UA_ExpandedNodeId *p, const UA_DataType *_) {
5058  NodeId_deleteMembers(&p->nodeId, _);
5059  String_deleteMembers(&p->namespaceUri, NULL);
5060 }
5061 
5062 static UA_StatusCode
5063 ExpandedNodeId_copy(UA_ExpandedNodeId const *src, UA_ExpandedNodeId *dst,
5064  const UA_DataType *_) {
5065  UA_StatusCode retval = NodeId_copy(&src->nodeId, &dst->nodeId, NULL);
5066  retval |= UA_String_copy(&src->namespaceUri, &dst->namespaceUri);
5067  dst->serverIndex = src->serverIndex;
5068  return retval;
5069 }
5070 
5071 /* ExtensionObject */
5072 static void
5073 ExtensionObject_deleteMembers(UA_ExtensionObject *p, const UA_DataType *_) {
5074  switch(p->encoding) {
5078  NodeId_deleteMembers(&p->content.encoded.typeId, NULL);
5079  String_deleteMembers(&p->content.encoded.body, NULL);
5080  break;
5082  if(p->content.decoded.data)
5083  UA_delete(p->content.decoded.data, p->content.decoded.type);
5084  break;
5085  default:
5086  break;
5087  }
5088 }
5089 
5090 static UA_StatusCode
5091 ExtensionObject_copy(UA_ExtensionObject const *src, UA_ExtensionObject *dst,
5092  const UA_DataType *_) {
5094  switch(src->encoding) {
5098  dst->encoding = src->encoding;
5099  retval = NodeId_copy(&src->content.encoded.typeId,
5100  &dst->content.encoded.typeId, NULL);
5101  retval |= UA_ByteString_copy(&src->content.encoded.body,
5102  &dst->content.encoded.body);
5103  break;
5106  if(!src->content.decoded.type || !src->content.decoded.data)
5109  dst->content.decoded.type = src->content.decoded.type;
5110  retval = UA_Array_copy(src->content.decoded.data, 1,
5111  &dst->content.decoded.data, src->content.decoded.type);
5112  break;
5113  default:
5114  break;
5115  }
5116  return retval;
5117 }
5118 
5119 /* Variant */
5120 static void
5121 Variant_deletemembers(UA_Variant *p, const UA_DataType *_) {
5122  if(p->storageType != UA_VARIANT_DATA)
5123  return;
5124  if(p->type && p->data > UA_EMPTY_ARRAY_SENTINEL) {
5125  if(p->arrayLength == 0)
5126  p->arrayLength = 1;
5127  UA_Array_delete(p->data, p->arrayLength, p->type);
5128  }
5131 }
5132 
5133 static UA_StatusCode
5134 Variant_copy(UA_Variant const *src, UA_Variant *dst, const UA_DataType *_) {
5135  size_t length = src->arrayLength;
5136  if(UA_Variant_isScalar(src))
5137  length = 1;
5138  UA_StatusCode retval = UA_Array_copy(src->data, length,
5139  &dst->data, src->type);
5140  if(retval != UA_STATUSCODE_GOOD)
5141  return retval;
5142  dst->arrayLength = src->arrayLength;
5143  dst->type = src->type;
5144  if(src->arrayDimensions) {
5146  (void**)&dst->arrayDimensions, &UA_TYPES[UA_TYPES_INT32]);
5147  if(retval != UA_STATUSCODE_GOOD)
5148  return retval;
5150  }
5151  return UA_STATUSCODE_GOOD;
5152 }
5153 
5154 void
5156  const UA_DataType *type) {
5157  UA_Variant_init(v);
5158  v->type = type;
5159  v->arrayLength = 0;
5160  v->data = p;
5161 }
5162 
5165  const UA_DataType *type) {
5166  void *n = UA_malloc(type->memSize);
5167  if(!n)
5169  UA_StatusCode retval = UA_copy(p, n, type);
5170  if(retval != UA_STATUSCODE_GOOD) {
5171  UA_free(n);
5172  //cppcheck-suppress memleak
5173  return retval;
5174  }
5175  UA_Variant_setScalar(v, n, type);
5176  //cppcheck-suppress memleak
5177  return UA_STATUSCODE_GOOD;
5178 }
5179 
5181  size_t arraySize, const UA_DataType *type) {
5182  UA_Variant_init(v);
5183  v->data = array;
5184  v->arrayLength = arraySize;
5185  v->type = type;
5186 }
5187 
5189 UA_Variant_setArrayCopy(UA_Variant *v, const void *array,
5190  size_t arraySize, const UA_DataType *type) {
5191  UA_Variant_init(v);
5192  UA_StatusCode retval = UA_Array_copy(array, arraySize, &v->data, type);
5193  if(retval != UA_STATUSCODE_GOOD)
5194  return retval;
5195  v->arrayLength = arraySize;
5196  v->type = type;
5197  return UA_STATUSCODE_GOOD;
5198 }
5199 
5200 /* Test if a range is compatible with a variant. If yes, the following values
5201  * are set:
5202  * - total: how many elements are in the range
5203  * - block: how big is each contiguous block of elements in the variant that
5204  * maps into the range
5205  * - stride: how many elements are between the blocks (beginning to beginning)
5206  * - first: where does the first block begin */
5207 static UA_StatusCode
5208 computeStrides(const UA_Variant *v, const UA_NumericRange range,
5209  size_t *total, size_t *block, size_t *stride, size_t *first) {
5210  /* Test for max array size */
5211 #if(MAX_SIZE > 0xffffffff) /* 64bit only */
5212  if(v->arrayLength > UA_UINT32_MAX)
5214 #endif
5215 
5216  /* Test the integrity of the source variant dimensions, make dimensions
5217  * vector of one dimension if none defined */
5218  UA_UInt32 arrayLength = (UA_UInt32)v->arrayLength;
5219  const UA_UInt32 *dims = &arrayLength;
5220  size_t dims_count = 1;
5221  if(v->arrayDimensionsSize > 0) {
5222  size_t elements = 1;
5223  dims_count = v->arrayDimensionsSize;
5224  dims = (UA_UInt32*)v->arrayDimensions;
5225  for(size_t i = 0; i < dims_count; ++i)
5226  elements *= dims[i];
5227  if(elements != v->arrayLength)
5229  }
5230  UA_assert(dims_count > 0);
5231 
5232  /* Test the integrity of the range and compute the max index used for every
5233  * dimension. The standard says in Part 4, Section 7.22:
5234  *
5235  * When reading a value, the indexes may not specify a range that is within
5236  * the bounds of the array. The Server shall return a partial result if some
5237  * elements exist within the range. */
5238  size_t count = 1;
5239  UA_UInt32 *realmax = UA_alloca(sizeof(UA_UInt32) * dims_count);
5240  if(range.dimensionsSize != dims_count)
5242  for(size_t i = 0; i < dims_count; ++i) {
5243  if(range.dimensions[i].min > range.dimensions[i].max)
5245  if(range.dimensions[i].min >= dims[i])
5247 
5248  if(range.dimensions[i].max < dims[i])
5249  realmax[i] = range.dimensions[i].max;
5250  else
5251  realmax[i] = dims[i] - 1;
5252 
5253  count *= (realmax[i] - range.dimensions[i].min) + 1;
5254  }
5255 
5256  *total = count;
5257 
5258  /* Compute the stride length and the position of the first element */
5259  *block = count; /* Assume the range describes the entire array. */
5260  *stride = v->arrayLength; /* So it can be copied as a contiguous block. */
5261  *first = 0;
5262  size_t running_dimssize = 1;
5263  UA_Boolean found_contiguous = false;
5264  for(size_t k = dims_count; k > 0;) {
5265  --k;
5266  size_t dimrange = 1 + realmax[k] - range.dimensions[k].min;
5267  if(!found_contiguous && dimrange != dims[k]) {
5268  /* Found the maximum block that can be copied contiguously */
5269  found_contiguous = true;
5270  *block = running_dimssize * dimrange;
5271  *stride = running_dimssize * dims[k];
5272  }
5273  *first += running_dimssize * range.dimensions[k].min;
5274  running_dimssize *= dims[k];
5275  }
5276  return UA_STATUSCODE_GOOD;
5277 }
5278 
5279 /* Is the type string-like? */
5280 static UA_Boolean
5281 isStringLike(const UA_DataType *type) {
5282  if(type->membersSize == 1 && type->members[0].isArray &&
5283  type->members[0].namespaceZero &&
5285  return true;
5286  return false;
5287 }
5288 
5289 /* Returns the part of the string that lies within the rangedimension */
5290 static UA_StatusCode
5291 copySubString(const UA_String *src, UA_String *dst,
5292  const UA_NumericRangeDimension *dim) {
5293  if(dim->min > dim->max)
5295  if(dim->min >= src->length)
5297 
5298  size_t length;
5299  if(dim->max < src->length)
5300  length = dim->max - dim->min + 1;
5301  else
5302  length = src->length - dim->min;
5303 
5304  UA_StatusCode retval = UA_ByteString_allocBuffer(dst, length);
5305  if(retval != UA_STATUSCODE_GOOD)
5306  return retval;
5307 
5308  memcpy(dst->data, &src->data[dim->min], length);
5309  return UA_STATUSCODE_GOOD;
5310 }
5311 
5314  const UA_NumericRange range) {
5315  UA_Boolean isScalar = UA_Variant_isScalar(src);
5316  UA_Boolean stringLike = isStringLike(src->type);
5317  UA_Variant arraySrc;
5318 
5319  /* Extract the range for copying at this level. The remaining range is dealt
5320  * with in the "scalar" type that may define an array by itself (string,
5321  * variant, ...). */
5322  UA_NumericRange thisrange, nextrange;
5323  UA_NumericRangeDimension scalarThisDimension = {0,0}; /* a single entry */
5324  if(isScalar) {
5325  /* Replace scalar src with array of length 1 */
5326  arraySrc = *src;
5327  arraySrc.arrayLength = 1;
5328  src = &arraySrc;
5329  /* Deal with all range dimensions within the scalar */
5330  thisrange.dimensions = &scalarThisDimension;
5331  thisrange.dimensionsSize = 1;
5332  nextrange = range;
5333  } else {
5334  /* Deal with as many range dimensions as possible right now */
5335  size_t dims = src->arrayDimensionsSize;
5336  if(dims == 0)
5337  dims = 1;
5338  if(dims > range.dimensionsSize)
5340  thisrange = range;
5341  thisrange.dimensionsSize = dims;
5342  nextrange.dimensions = &range.dimensions[dims];
5343  nextrange.dimensionsSize = range.dimensionsSize - dims;
5344  }
5345 
5346  /* Compute the strides */
5347  size_t count, block, stride, first;
5348  UA_StatusCode retval = computeStrides(src, thisrange, &count,
5349  &block, &stride, &first);
5350  if(retval != UA_STATUSCODE_GOOD)
5351  return retval;
5352 
5353  /* Allocate the array */
5354  UA_Variant_init(dst);
5355  dst->data = UA_Array_new(count, src->type);
5356  if(!dst->data)
5358 
5359  /* Copy the range */
5360  size_t block_count = count / block;
5361  size_t elem_size = src->type->memSize;
5362  uintptr_t nextdst = (uintptr_t)dst->data;
5363  uintptr_t nextsrc = (uintptr_t)src->data + (elem_size * first);
5364  if(nextrange.dimensionsSize == 0) {
5365  /* no nextrange */
5366  if(src->type->fixedSize) {
5367  for(size_t i = 0; i < block_count; ++i) {
5368  memcpy((void*)nextdst, (void*)nextsrc, elem_size * block);
5369  nextdst += block * elem_size;
5370  nextsrc += stride * elem_size;
5371  }
5372  } else {
5373  for(size_t i = 0; i < block_count; ++i) {
5374  for(size_t j = 0; j < block; ++j) {
5375  retval = UA_copy((const void*)nextsrc,
5376  (void*)nextdst, src->type);
5377  nextdst += elem_size;
5378  nextsrc += elem_size;
5379  }
5380  nextsrc += (stride - block) * elem_size;
5381  }
5382  }
5383  } else {
5384  /* nextrange can only be used for variants and stringlike with remaining
5385  * range of dimension 1 */
5386  if(src->type != &UA_TYPES[UA_TYPES_VARIANT]) {
5387  if(!stringLike)
5389  if(nextrange.dimensionsSize != 1)
5391  }
5392 
5393  /* Copy the content */
5394  for(size_t i = 0; i < block_count; ++i) {
5395  for(size_t j = 0; j < block && retval == UA_STATUSCODE_GOOD; ++j) {
5396  if(stringLike)
5397  retval = copySubString((const UA_String*)nextsrc,
5398  (UA_String*)nextdst,
5399  nextrange.dimensions);
5400  else
5401  retval = UA_Variant_copyRange((const UA_Variant*)nextsrc,
5402  (UA_Variant*)nextdst,
5403  nextrange);
5404  nextdst += elem_size;
5405  nextsrc += elem_size;
5406  }
5407  nextsrc += (stride - block) * elem_size;
5408  }
5409  }
5410 
5411  /* Clean up if copying failed */
5412  if(retval != UA_STATUSCODE_GOOD) {
5413  UA_Array_delete(dst->data, count, src->type);
5414  dst->data = NULL;
5415  return retval;
5416  }
5417 
5418  /* Done if scalar */
5419  dst->type = src->type;
5420  if(isScalar)
5421  return retval;
5422 
5423  /* Copy array dimensions */
5424  dst->arrayLength = count;
5425  if(src->arrayDimensionsSize > 0) {
5426  dst->arrayDimensions =
5428  if(!dst->arrayDimensions) {
5429  Variant_deletemembers(dst, NULL);
5431  }
5432  dst->arrayDimensionsSize = thisrange.dimensionsSize;
5433  for(size_t k = 0; k < thisrange.dimensionsSize; ++k)
5434  dst->arrayDimensions[k] =
5435  thisrange.dimensions[k].max - thisrange.dimensions[k].min + 1;
5436  }
5437  return UA_STATUSCODE_GOOD;
5438 }
5439 
5440 /* TODO: Allow ranges to reach inside a scalars that are array-like, e.g.
5441  * variant and strings. This is already possible for reading... */
5442 static UA_StatusCode
5443 Variant_setRange(UA_Variant *v, void *array, size_t arraySize,
5444  const UA_NumericRange range, UA_Boolean copy) {
5445  /* Compute the strides */
5446  size_t count, block, stride, first;
5447  UA_StatusCode retval = computeStrides(v, range, &count,
5448  &block, &stride, &first);
5449  if(retval != UA_STATUSCODE_GOOD)
5450  return retval;
5451  if(count != arraySize)
5453 
5454  /* Move/copy the elements */
5455  size_t block_count = count / block;
5456  size_t elem_size = v->type->memSize;
5457  uintptr_t nextdst = (uintptr_t)v->data + (first * elem_size);
5458  uintptr_t nextsrc = (uintptr_t)array;
5459  if(v->type->fixedSize || !copy) {
5460  for(size_t i = 0; i < block_count; ++i) {
5461  memcpy((void*)nextdst, (void*)nextsrc, elem_size * block);
5462  nextsrc += block * elem_size;
5463  nextdst += stride * elem_size;
5464  }
5465  } else {
5466  for(size_t i = 0; i < block_count; ++i) {
5467  for(size_t j = 0; j < block; ++j) {
5468  deleteMembers_noInit((void*)nextdst, v->type);
5469  retval |= UA_copy((void*)nextsrc, (void*)nextdst, v->type);
5470  nextdst += elem_size;
5471  nextsrc += elem_size;
5472  }
5473  nextdst += (stride - block) * elem_size;
5474  }
5475  }
5476 
5477  /* If members were moved, initialize original array to prevent reuse */
5478  if(!copy && !v->type->fixedSize)
5479  memset(array, 0, sizeof(elem_size)*arraySize);
5480 
5481  return retval;
5482 }
5483 
5486  size_t arraySize, const UA_NumericRange range) {
5487  return Variant_setRange(v, array, arraySize, range, false);
5488 }
5489 
5491 UA_Variant_setRangeCopy(UA_Variant *v, const void *array,
5492  size_t arraySize, const UA_NumericRange range) {
5493  return Variant_setRange(v, (void*)(uintptr_t)array,
5494  arraySize, range, true);
5495 }
5496 
5497 /* LocalizedText */
5498 static void
5499 LocalizedText_deleteMembers(UA_LocalizedText *p, const UA_DataType *_) {
5500  String_deleteMembers(&p->locale, NULL);
5501  String_deleteMembers(&p->text, NULL);
5502 }
5503 
5504 static UA_StatusCode
5505 LocalizedText_copy(UA_LocalizedText const *src, UA_LocalizedText *dst,
5506  const UA_DataType *_) {
5507  UA_StatusCode retval = UA_String_copy(&src->locale, &dst->locale);
5508  retval |= UA_String_copy(&src->text, &dst->text);
5509  return retval;
5510 }
5511 
5512 /* DataValue */
5513 static void
5514 DataValue_deleteMembers(UA_DataValue *p, const UA_DataType *_) {
5515  Variant_deletemembers(&p->value, NULL);
5516 }
5517 
5518 static UA_StatusCode
5519 DataValue_copy(UA_DataValue const *src, UA_DataValue *dst,
5520  const UA_DataType *_) {
5521  memcpy(dst, src, sizeof(UA_DataValue));
5522  UA_Variant_init(&dst->value);
5523  UA_StatusCode retval = Variant_copy(&src->value, &dst->value, NULL);
5524  if(retval != UA_STATUSCODE_GOOD)
5525  DataValue_deleteMembers(dst, NULL);
5526  return retval;
5527 }
5528 
5529 /* DiagnosticInfo */
5530 static void
5531 DiagnosticInfo_deleteMembers(UA_DiagnosticInfo *p, const UA_DataType *_) {
5532  String_deleteMembers(&p->additionalInfo, NULL);
5534  DiagnosticInfo_deleteMembers(p->innerDiagnosticInfo, NULL);
5536  }
5537 }
5538 
5539 static UA_StatusCode
5540 DiagnosticInfo_copy(UA_DiagnosticInfo const *src, UA_DiagnosticInfo *dst,
5541  const UA_DataType *_) {
5542  memcpy(dst, src, sizeof(UA_DiagnosticInfo));
5543  UA_String_init(&dst->additionalInfo);
5544  dst->innerDiagnosticInfo = NULL;
5546  if(src->hasAdditionalInfo)
5547  retval = UA_String_copy(&src->additionalInfo, &dst->additionalInfo);
5548  if(src->hasInnerDiagnosticInfo && src->innerDiagnosticInfo) {
5550  if(dst->innerDiagnosticInfo) {
5551  retval |= DiagnosticInfo_copy(src->innerDiagnosticInfo,
5552  dst->innerDiagnosticInfo, NULL);
5553  dst->hasInnerDiagnosticInfo = true;
5554  } else {
5555  dst->hasInnerDiagnosticInfo = false;
5556  retval |= UA_STATUSCODE_BADOUTOFMEMORY;
5557  }
5558  }
5559  return retval;
5560 }
5561 
5562 /********************/
5563 /* Structured Types */
5564 /********************/
5565 
5566 void *
5567 UA_new(const UA_DataType *type) {
5568  void *p = UA_calloc(1, type->memSize);
5569  return p;
5570 }
5571 
5572 static UA_StatusCode
5573 copyByte(const UA_Byte *src, UA_Byte *dst, const UA_DataType *_) {
5574  *dst = *src;
5575  return UA_STATUSCODE_GOOD;
5576 }
5577 
5578 static UA_StatusCode
5579 copy2Byte(const UA_UInt16 *src, UA_UInt16 *dst, const UA_DataType *_) {
5580  *dst = *src;
5581  return UA_STATUSCODE_GOOD;
5582 }
5583 
5584 static UA_StatusCode
5585 copy4Byte(const UA_UInt32 *src, UA_UInt32 *dst, const UA_DataType *_) {
5586  *dst = *src;
5587  return UA_STATUSCODE_GOOD;
5588 }
5589 
5590 static UA_StatusCode
5591 copy8Byte(const UA_UInt64 *src, UA_UInt64 *dst, const UA_DataType *_) {
5592  *dst = *src;
5593  return UA_STATUSCODE_GOOD;
5594 }
5595 
5596 static UA_StatusCode
5597 copyGuid(const UA_Guid *src, UA_Guid *dst, const UA_DataType *_) {
5598  *dst = *src;
5599  return UA_STATUSCODE_GOOD;
5600 }
5601 
5602 typedef UA_StatusCode
5603 (*UA_copySignature)(const void *src, void *dst, const UA_DataType *type);
5604 
5605 static const UA_copySignature copyJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = {
5606  (UA_copySignature)copyByte, // Boolean
5607  (UA_copySignature)copyByte, // SByte
5608  (UA_copySignature)copyByte, // Byte
5609  (UA_copySignature)copy2Byte, // Int16
5610  (UA_copySignature)copy2Byte, // UInt16
5611  (UA_copySignature)copy4Byte, // Int32
5612  (UA_copySignature)copy4Byte, // UInt32
5613  (UA_copySignature)copy8Byte, // Int64
5614  (UA_copySignature)copy8Byte, // UInt64
5615  (UA_copySignature)copy4Byte, // Float
5616  (UA_copySignature)copy8Byte, // Double
5617  (UA_copySignature)copy_noInit, // String
5618  (UA_copySignature)copy8Byte, // DateTime
5619  (UA_copySignature)copyGuid, // Guid
5620  (UA_copySignature)copy_noInit, // ByteString
5621  (UA_copySignature)copy_noInit, // XmlElement
5622  (UA_copySignature)NodeId_copy,
5623  (UA_copySignature)ExpandedNodeId_copy,
5624  (UA_copySignature)copy4Byte, // StatusCode
5625  (UA_copySignature)copy_noInit, // QualifiedName
5626  (UA_copySignature)LocalizedText_copy, // LocalizedText
5627  (UA_copySignature)ExtensionObject_copy,
5628  (UA_copySignature)DataValue_copy,
5629  (UA_copySignature)Variant_copy,
5630  (UA_copySignature)DiagnosticInfo_copy,
5631  (UA_copySignature)copy_noInit // all others
5632 };
5633 
5634 static UA_StatusCode
5635 copy_noInit(const void *src, void *dst, const UA_DataType *type) {
5637  uintptr_t ptrs = (uintptr_t)src;
5638  uintptr_t ptrd = (uintptr_t)dst;
5639  UA_Byte membersSize = type->membersSize;
5640  for(size_t i = 0; i < membersSize; ++i) {
5641  const UA_DataTypeMember *m= &type->members[i];
5642  const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
5643  const UA_DataType *mt = &typelists[!m->namespaceZero][m->memberTypeIndex];
5644  if(!m->isArray) {
5645  ptrs += m->padding;
5646  ptrd += m->padding;
5647  size_t fi = mt->builtin ? mt->typeIndex : UA_BUILTIN_TYPES_COUNT;
5648  retval |= copyJumpTable[fi]((const void*)ptrs, (void*)ptrd, mt);
5649  ptrs += mt->memSize;
5650  ptrd += mt->memSize;
5651  } else {
5652  ptrs += m->padding;
5653  ptrd += m->padding;
5654  size_t *dst_size = (size_t*)ptrd;
5655  const size_t size = *((const size_t*)ptrs);
5656  ptrs += sizeof(size_t);
5657  ptrd += sizeof(size_t);
5658  retval |= UA_Array_copy(*(void* const*)ptrs, size, (void**)ptrd, mt);
5659  if(retval == UA_STATUSCODE_GOOD)
5660  *dst_size = size;
5661  else
5662  *dst_size = 0;
5663  ptrs += sizeof(void*);
5664  ptrd += sizeof(void*);
5665  }
5666  }
5667  return retval;
5668 }
5669 
5671 UA_copy(const void *src, void *dst, const UA_DataType *type) {
5672  memset(dst, 0, type->memSize); /* init */
5673  UA_StatusCode retval = copy_noInit(src, dst, type);
5674  if(retval != UA_STATUSCODE_GOOD)
5675  UA_deleteMembers(dst, type);
5676  return retval;
5677 }
5678 
5679 static void nopDeleteMembers(void *p, const UA_DataType *type) { }
5680 
5681 typedef void (*UA_deleteMembersSignature)(void *p, const UA_DataType *type);
5682 
5683 static const
5684 UA_deleteMembersSignature deleteMembersJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = {
5685  (UA_deleteMembersSignature)nopDeleteMembers, // Boolean
5686  (UA_deleteMembersSignature)nopDeleteMembers, // SByte
5687  (UA_deleteMembersSignature)nopDeleteMembers, // Byte
5688  (UA_deleteMembersSignature)nopDeleteMembers, // Int16
5689  (UA_deleteMembersSignature)nopDeleteMembers, // UInt16
5690  (UA_deleteMembersSignature)nopDeleteMembers, // Int32
5691  (UA_deleteMembersSignature)nopDeleteMembers, // UInt32
5692  (UA_deleteMembersSignature)nopDeleteMembers, // Int64
5693  (UA_deleteMembersSignature)nopDeleteMembers, // UInt64
5694  (UA_deleteMembersSignature)nopDeleteMembers, // Float
5695  (UA_deleteMembersSignature)nopDeleteMembers, // Double
5696  (UA_deleteMembersSignature)String_deleteMembers, // String
5697  (UA_deleteMembersSignature)nopDeleteMembers, // DateTime
5698  (UA_deleteMembersSignature)nopDeleteMembers, // Guid
5699  (UA_deleteMembersSignature)String_deleteMembers, // ByteString
5700  (UA_deleteMembersSignature)String_deleteMembers, // XmlElement
5701  (UA_deleteMembersSignature)NodeId_deleteMembers,
5702  (UA_deleteMembersSignature)ExpandedNodeId_deleteMembers, // ExpandedNodeId
5703  (UA_deleteMembersSignature)nopDeleteMembers, // StatusCode
5704  (UA_deleteMembersSignature)deleteMembers_noInit, // QualifiedName
5705  (UA_deleteMembersSignature)LocalizedText_deleteMembers, // LocalizedText
5706  (UA_deleteMembersSignature)ExtensionObject_deleteMembers,
5707  (UA_deleteMembersSignature)DataValue_deleteMembers,
5708  (UA_deleteMembersSignature)Variant_deletemembers,
5709  (UA_deleteMembersSignature)DiagnosticInfo_deleteMembers,
5710  (UA_deleteMembersSignature)deleteMembers_noInit,
5711 };
5712 
5713 static void
5714 deleteMembers_noInit(void *p, const UA_DataType *type) {
5715  uintptr_t ptr = (uintptr_t)p;
5716  UA_Byte membersSize = type->membersSize;
5717  for(size_t i = 0; i < membersSize; ++i) {
5718  const UA_DataTypeMember *m= &type->members[i];
5719  const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
5720  const UA_DataType *mt = &typelists[!m->namespaceZero][m->memberTypeIndex];
5721  if(!m->isArray) {
5722  ptr += m->padding;
5723  size_t fi = mt->builtin ? mt->typeIndex : UA_BUILTIN_TYPES_COUNT;
5724  deleteMembersJumpTable[fi]((void*)ptr, mt);
5725  ptr += mt->memSize;
5726  } else {
5727  ptr += m->padding;
5728  size_t length = *(size_t*)ptr;
5729  ptr += sizeof(size_t);
5730  UA_Array_delete(*(void**)ptr, length, mt);
5731  ptr += sizeof(void*);
5732  }
5733  }
5734 }
5735 
5736 void
5737 UA_deleteMembers(void *p, const UA_DataType *type) {
5738  deleteMembers_noInit(p, type);
5739  memset(p, 0, type->memSize); /* init */
5740 }
5741 
5742 void
5743 UA_delete(void *p, const UA_DataType *type) {
5744  deleteMembers_noInit(p, type);
5745  UA_free(p);
5746 }
5747 
5748 /******************/
5749 /* Array Handling */
5750 /******************/
5751 
5752 void *
5753 UA_Array_new(size_t size, const UA_DataType *type) {
5754  if(size == 0)
5755  return UA_EMPTY_ARRAY_SENTINEL;
5756  return UA_calloc(size, type->memSize);
5757 }
5758 
5760 UA_Array_copy(const void *src, size_t size,
5761  void **dst, const UA_DataType *type) {
5762  if(size == 0) {
5763  if(src == NULL)
5764  *dst = NULL;
5765  else
5767  return UA_STATUSCODE_GOOD;
5768  }
5769 
5770  if(!type)
5772 
5773  /* calloc, so we don't have to check retval in every iteration of copying */
5774  *dst = UA_calloc(size, type->memSize);
5775  if(!*dst)
5777 
5778  if(type->fixedSize) {
5779  memcpy(*dst, src, type->memSize * size);
5780  return UA_STATUSCODE_GOOD;
5781  }
5782 
5783  uintptr_t ptrs = (uintptr_t)src;
5784  uintptr_t ptrd = (uintptr_t)*dst;
5786  for(size_t i = 0; i < size; ++i) {
5787  retval |= UA_copy((void*)ptrs, (void*)ptrd, type);
5788  ptrs += type->memSize;
5789  ptrd += type->memSize;
5790  }
5791  if(retval != UA_STATUSCODE_GOOD) {
5792  UA_Array_delete(*dst, size, type);
5793  *dst = NULL;
5794  }
5795  return retval;
5796 }
5797 
5798 void
5799 UA_Array_delete(void *p, size_t size, const UA_DataType *type) {
5800  if(!type->fixedSize) {
5801  uintptr_t ptr = (uintptr_t)p;
5802  for(size_t i = 0; i < size; ++i) {
5803  UA_deleteMembers((void*)ptr, type);
5804  ptr += type->memSize;
5805  }
5806  }
5807  UA_free((void*)((uintptr_t)p & ~(uintptr_t)UA_EMPTY_ARRAY_SENTINEL));
5808 }
5809 
5810 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_types_encoding_binary.c" ***********************************/
5811 
5812 /* This Source Code Form is subject to the terms of the Mozilla Public
5813  * License, v. 2.0. If a copy of the MPL was not distributed with this
5814  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5815 
5816 
5817 /* Type Encoding
5818  * -------------
5819  * This file contains encoding functions for the builtin data types and generic
5820  * functions that operate on all types and arrays. This requires the type
5821  * description from a UA_DataType structure. Note that some internal (static)
5822  * deocidng functions may abort and leave the type in an inconsistent state. But
5823  * this is always handled in UA_decodeBinary, where the error is caught and the
5824  * type cleaned up.
5825  *
5826  * Breaking a message into chunks is integrated with the encoding. When the end
5827  * of a buffer is reached, a callback is executed that sends the current buffer
5828  * as a chunk and exchanges the encoding buffer "underneath" the ongoing
5829  * encoding. This enables fast sending of large messages as spurious copying is
5830  * avoided. */
5831 
5832 #if defined(__clang__)
5833 # pragma GCC diagnostic push
5834 # pragma GCC diagnostic warning "-W#warnings"
5835 #endif
5836 
5837 #ifndef UA_BINARY_OVERLAYABLE_INTEGER
5838 # warning Integer endianness could not be detected to be little endian. Use slow generic encoding.
5839 #endif
5840 
5841 /* There is no robust way to detect float endianness in clang. This warning can be removed
5842  * if the target is known to be little endian with floats in the IEEE 754 format. */
5843 #ifndef UA_BINARY_OVERLAYABLE_FLOAT
5844 # warning Float endianness could not be detected to be little endian in the IEEE 754 format. Use slow generic encoding.
5845 #endif
5846 
5847 #if defined(__clang__)
5848 # pragma GCC diagnostic pop
5849 #endif
5850 
5851 /* Jumptables for de-/encoding and computing the buffer length. The methods in
5852  * the decoding jumptable do not all clean up their allocated memory when an
5853  * error occurs. So a final _deleteMembers needs to be called before returning
5854  * to the user. */
5855 typedef status (*UA_encodeBinarySignature)(const void *UA_RESTRICT src, const UA_DataType *type);
5857 
5858 typedef status (*UA_decodeBinarySignature)(void *UA_RESTRICT dst, const UA_DataType *type);
5860 
5861 typedef size_t (*UA_calcSizeBinarySignature)(const void *UA_RESTRICT p, const UA_DataType *contenttype);
5863 
5864 /* Pointers to the current position and the last position in the buffer */
5865 static UA_THREAD_LOCAL u8 *g_pos;
5866 static UA_THREAD_LOCAL const u8 *g_end;
5867 static UA_THREAD_LOCAL UA_ByteString g_buf;
5868 
5869 /* In UA_encodeBinaryInternal, we store a pointer to the last "good" position in
5870  * the buffer. When encoding reaches the end of the buffer, send out a chunk
5871  * until that position, replace the buffer and retry encoding after the last
5872  * "checkpoint". The status code UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED is used
5873  * exclusively to indicate that the end of the buffer was reached.
5874  *
5875  * In order to prevent restoring to an old buffer position (where the buffer was
5876  * exchanged within a call from UA_encodeBinaryInternal and is no longer
5877  * valied), no methods must return UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED after
5878  * calling exchangeBuffer(). This needs to be ensured for the following methods:
5879  *
5880  * UA_encodeBinaryInternal
5881  * Array_encodeBinary
5882  * NodeId_encodeBinary
5883  * ExpandedNodeId_encodeBinary
5884  * LocalizedText_encodeBinary
5885  * ExtensionObject_encodeBinary
5886  * Variant_encodeBinary
5887  * DataValue_encodeBinary
5888  * DiagnosticInfo_encodeBinary */
5889 
5890 /* Thread-local buffers used for exchanging the buffer for chunking */
5891 static UA_THREAD_LOCAL UA_exchangeEncodeBuffer g_exchangeBufferCallback;
5892 static UA_THREAD_LOCAL void *g_exchangeBufferCallbackHandle;
5893 
5894 /* Send the current chunk and replace the buffer */
5895 static status
5896 exchangeBuffer(void) {
5897  if(!g_exchangeBufferCallback)
5899 
5900  /* Store context variables since exchangeBuffer might call UA_encode itself */
5901  UA_exchangeEncodeBuffer store_exchangeBufferCallback = g_exchangeBufferCallback;
5902  void *store_exchangeBufferCallbackHandle = g_exchangeBufferCallbackHandle;
5903  UA_ByteString buf = g_buf;
5904  size_t offset = (uintptr_t)(g_pos - g_buf.data);
5905 
5906  status ret = g_exchangeBufferCallback(g_exchangeBufferCallbackHandle, &buf, offset);
5907 
5908  /* Restore context variables */
5909  g_exchangeBufferCallback = store_exchangeBufferCallback;
5910  g_exchangeBufferCallbackHandle = store_exchangeBufferCallbackHandle;
5911  g_buf = buf;
5912  g_pos = buf.data;
5913  g_end = &buf.data[buf.length];
5914  return ret;
5915 }
5916 
5917 /*****************/
5918 /* Integer Types */
5919 /*****************/
5920 
5921 #if !UA_BINARY_OVERLAYABLE_INTEGER
5922 
5923 /* These en/decoding functions are only used when the architecture isn't little-endian. */
5924 static void
5925 UA_encode16(const u16 v, u8 buf[2]) {
5926  buf[0] = (u8)v;
5927  buf[1] = (u8)(v >> 8);
5928 }
5929 
5930 static void
5931 UA_decode16(const u8 buf[2], u16 *v) {
5932  *v = (u16)((u16)buf[0] + (((u16)buf[1]) << 8));
5933 }
5934 
5935 static void
5936 UA_encode32(const u32 v, u8 buf[4]) {
5937  buf[0] = (u8)v;
5938  buf[1] = (u8)(v >> 8);
5939  buf[2] = (u8)(v >> 16);
5940  buf[3] = (u8)(v >> 24);
5941 }
5942 
5943 static void
5944 UA_decode32(const u8 buf[4], u32 *v) {
5945  *v = (u32)((u32)buf[0] +
5946  (((u32)buf[1]) << 8) +
5947  (((u32)buf[2]) << 16) +
5948  (((u32)buf[3]) << 24));
5949 }
5950 
5951 static void
5952 UA_encode64(const u64 v, u8 buf[8]) {
5953  buf[0] = (u8)v;
5954  buf[1] = (u8)(v >> 8);
5955  buf[2] = (u8)(v >> 16);
5956  buf[3] = (u8)(v >> 24);
5957  buf[4] = (u8)(v >> 32);
5958  buf[5] = (u8)(v >> 40);
5959  buf[6] = (u8)(v >> 48);
5960  buf[7] = (u8)(v >> 56);
5961 }
5962 
5963 static void
5964 UA_decode64(const u8 buf[8], u64 *v) {
5965  *v = (u64)((u64)buf[0] +
5966  (((u64)buf[1]) << 8) +
5967  (((u64)buf[2]) << 16) +
5968  (((u64)buf[3]) << 24) +
5969  (((u64)buf[4]) << 32) +
5970  (((u64)buf[5]) << 40) +
5971  (((u64)buf[6]) << 48) +
5972  (((u64)buf[7]) << 56));
5973 }
5974 
5975 #endif /* !UA_BINARY_OVERLAYABLE_INTEGER */
5976 
5977 /* Boolean */
5978 static status
5979 Boolean_encodeBinary(const bool *src, const UA_DataType *_) {
5980  if(g_pos + sizeof(bool) > g_end)
5982  *g_pos = *(const u8*)src;
5983  ++g_pos;
5984  return UA_STATUSCODE_GOOD;
5985 }
5986 
5987 static status
5988 Boolean_decodeBinary(bool *dst, const UA_DataType *_) {
5989  if(g_pos + sizeof(bool) > g_end)
5991  *dst = (*g_pos > 0) ? true : false;
5992  ++g_pos;
5993  return UA_STATUSCODE_GOOD;
5994 }
5995 
5996 /* Byte */
5997 static status
5998 Byte_encodeBinary(const u8 *src, const UA_DataType *_) {
5999  if(g_pos + sizeof(u8) > g_end)
6001  *g_pos = *(const u8*)src;
6002  ++g_pos;
6003  return UA_STATUSCODE_GOOD;
6004 }
6005 
6006 static status
6007 Byte_decodeBinary(u8 *dst, const UA_DataType *_) {
6008  if(g_pos + sizeof(u8) > g_end)
6010  *dst = *g_pos;
6011  ++g_pos;
6012  return UA_STATUSCODE_GOOD;
6013 }
6014 
6015 /* UInt16 */
6016 static status
6017 UInt16_encodeBinary(u16 const *src, const UA_DataType *_) {
6018  if(g_pos + sizeof(u16) > g_end)
6020 #if UA_BINARY_OVERLAYABLE_INTEGER
6021  memcpy(g_pos, src, sizeof(u16));
6022 #else
6023  UA_encode16(*src, g_pos);
6024 #endif
6025  g_pos += 2;
6026  return UA_STATUSCODE_GOOD;
6027 }
6028 
6029 static status
6030 UInt16_decodeBinary(u16 *dst, const UA_DataType *_) {
6031  if(g_pos + sizeof(u16) > g_end)
6033 #if UA_BINARY_OVERLAYABLE_INTEGER
6034  memcpy(dst, g_pos, sizeof(u16));
6035 #else
6036  UA_decode16(g_pos, dst);
6037 #endif
6038  g_pos += 2;
6039  return UA_STATUSCODE_GOOD;
6040 }
6041 
6042 /* UInt32 */
6043 static status
6044 UInt32_encodeBinary(u32 const *src, const UA_DataType *_) {
6045  if(g_pos + sizeof(u32) > g_end)
6047 #if UA_BINARY_OVERLAYABLE_INTEGER
6048  memcpy(g_pos, src, sizeof(u32));
6049 #else
6050  UA_encode32(*src, g_pos);
6051 #endif
6052  g_pos += 4;
6053  return UA_STATUSCODE_GOOD;
6054 }
6055 
6056 static UA_INLINE status
6057 Int32_encodeBinary(i32 const *src) {
6058  return UInt32_encodeBinary((const u32*)src, NULL);
6059 }
6060 
6061 static status
6062 UInt32_decodeBinary(u32 *dst, const UA_DataType *_) {
6063  if(g_pos + sizeof(u32) > g_end)
6065 #if UA_BINARY_OVERLAYABLE_INTEGER
6066  memcpy(dst, g_pos, sizeof(u32));
6067 #else
6068  UA_decode32(g_pos, dst);
6069 #endif
6070  g_pos += 4;
6071  return UA_STATUSCODE_GOOD;
6072 }
6073 
6074 static UA_INLINE status
6075 Int32_decodeBinary(i32 *dst) {
6076  return UInt32_decodeBinary((u32*)dst, NULL);
6077 }
6078 
6079 static UA_INLINE status
6080 StatusCode_decodeBinary(status *dst) {
6081  return UInt32_decodeBinary((u32*)dst, NULL);
6082 }
6083 
6084 /* UInt64 */
6085 static status
6086 UInt64_encodeBinary(u64 const *src, const UA_DataType *_) {
6087  if(g_pos + sizeof(u64) > g_end)
6089 #if UA_BINARY_OVERLAYABLE_INTEGER
6090  memcpy(g_pos, src, sizeof(u64));
6091 #else
6092  UA_encode64(*src, g_pos);
6093 #endif
6094  g_pos += 8;
6095  return UA_STATUSCODE_GOOD;
6096 }
6097 
6098 static status
6099 UInt64_decodeBinary(u64 *dst, const UA_DataType *_) {
6100  if(g_pos + sizeof(u64) > g_end)
6102 #if UA_BINARY_OVERLAYABLE_INTEGER
6103  memcpy(dst, g_pos, sizeof(u64));
6104 #else
6105  UA_decode64(g_pos, dst);
6106 #endif
6107  g_pos += 8;
6108  return UA_STATUSCODE_GOOD;
6109 }
6110 
6111 static UA_INLINE status
6112 DateTime_decodeBinary(UA_DateTime *dst) {
6113  return UInt64_decodeBinary((u64*)dst, NULL);
6114 }
6115 
6116 /************************/
6117 /* Floating Point Types */
6118 /************************/
6119 
6120 #if UA_BINARY_OVERLAYABLE_FLOAT
6121 # define Float_encodeBinary UInt32_encodeBinary
6122 # define Float_decodeBinary UInt32_decodeBinary
6123 # define Double_encodeBinary UInt64_encodeBinary
6124 # define Double_decodeBinary UInt64_decodeBinary
6125 #else
6126 
6127 #include <math.h>
6128 
6129 /* Handling of IEEE754 floating point values was taken from Beej's Guide to
6130  * Network Programming (http://beej.us/guide/bgnet/) and enhanced to cover the
6131  * edge cases +/-0, +/-inf and nan. */
6132 static uint64_t
6133 pack754(long double f, unsigned bits, unsigned expbits) {
6134  unsigned significandbits = bits - expbits - 1;
6135  long double fnorm;
6136  long long sign;
6137  if (f < 0) { sign = 1; fnorm = -f; }
6138  else { sign = 0; fnorm = f; }
6139  int shift = 0;
6140  while(fnorm >= 2.0) { fnorm /= 2.0; ++shift; }
6141  while(fnorm < 1.0) { fnorm *= 2.0; --shift; }
6142  fnorm = fnorm - 1.0;
6143  long long significand = (long long)(fnorm * ((float)(1LL<<significandbits) + 0.5f));
6144  long long exponent = shift + ((1<<(expbits-1)) - 1);
6145  return (uint64_t)((sign<<(bits-1)) | (exponent<<(bits-expbits-1)) | significand);
6146 }
6147 
6148 static long double
6149 unpack754(uint64_t i, unsigned bits, unsigned expbits) {
6150  unsigned significandbits = bits - expbits - 1;
6151  long double result = (long double)(i&(uint64_t)((1LL<<significandbits)-1));
6152  result /= (1LL<<significandbits);
6153  result += 1.0f;
6154  unsigned bias = (unsigned)(1<<(expbits-1)) - 1;
6155  long long shift = (long long)((i>>significandbits) & (uint64_t)((1LL<<expbits)-1)) - bias;
6156  while(shift > 0) { result *= 2.0; --shift; }
6157  while(shift < 0) { result /= 2.0; ++shift; }
6158  result *= ((i>>(bits-1))&1)? -1.0: 1.0;
6159  return result;
6160 }
6161 
6162 /* Float */
6163 #define FLOAT_NAN 0xffc00000
6164 #define FLOAT_INF 0x7f800000
6165 #define FLOAT_NEG_INF 0xff800000
6166 #define FLOAT_NEG_ZERO 0x80000000
6167 
6168 static status
6169 Float_encodeBinary(UA_Float const *src, const UA_DataType *_) {
6170  UA_Float f = *src;
6171  u32 encoded;
6172  //cppcheck-suppress duplicateExpression
6173  if(f != f) encoded = FLOAT_NAN;
6174  else if(f == 0.0f) encoded = signbit(f) ? FLOAT_NEG_ZERO : 0;
6175  //cppcheck-suppress duplicateExpression
6176  else if(f/f != f/f) encoded = f > 0 ? FLOAT_INF : FLOAT_NEG_INF;
6177  else encoded = (u32)pack754(f, 32, 8);
6178  return UInt32_encodeBinary(&encoded, NULL);
6179 }
6180 
6181 static status
6182 Float_decodeBinary(UA_Float *dst, const UA_DataType *_) {
6183  u32 decoded;
6184  status ret = UInt32_decodeBinary(&decoded, NULL);
6185  if(ret != UA_STATUSCODE_GOOD)
6186  return ret;
6187  if(decoded == 0) *dst = 0.0f;
6188  else if(decoded == FLOAT_NEG_ZERO) *dst = -0.0f;
6189  else if(decoded == FLOAT_INF) *dst = INFINITY;
6190  else if(decoded == FLOAT_NEG_INF) *dst = -INFINITY;
6191  else if((decoded >= 0x7f800001 && decoded <= 0x7fffffff) ||
6192  (decoded >= 0xff800001 && decoded <= 0xffffffff)) *dst = NAN;
6193  else *dst = (UA_Float)unpack754(decoded, 32, 8);
6194  return UA_STATUSCODE_GOOD;
6195 }
6196 
6197 /* Double */
6198 #define DOUBLE_NAN 0xfff8000000000000L
6199 #define DOUBLE_INF 0x7ff0000000000000L
6200 #define DOUBLE_NEG_INF 0xfff0000000000000L
6201 #define DOUBLE_NEG_ZERO 0x8000000000000000L
6202 
6203 static status
6204 Double_encodeBinary(UA_Double const *src, const UA_DataType *_) {
6205  UA_Double d = *src;
6206  u64 encoded;
6207  //cppcheck-suppress duplicateExpression
6208  if(d != d) encoded = DOUBLE_NAN;
6209  else if(d == 0.0) encoded = signbit(d) ? DOUBLE_NEG_ZERO : 0;
6210  //cppcheck-suppress duplicateExpression
6211  else if(d/d != d/d) encoded = d > 0 ? DOUBLE_INF : DOUBLE_NEG_INF;
6212  else encoded = pack754(d, 64, 11);
6213  return UInt64_encodeBinary(&encoded, NULL);
6214 }
6215 
6216 static status
6217 Double_decodeBinary(UA_Double *dst, const UA_DataType *_) {
6218  u64 decoded;
6219  status ret = UInt64_decodeBinary(&decoded, NULL);
6220  if(ret != UA_STATUSCODE_GOOD)
6221  return ret;
6222  if(decoded == 0) *dst = 0.0;
6223  else if(decoded == DOUBLE_NEG_ZERO) *dst = -0.0;
6224  else if(decoded == DOUBLE_INF) *dst = INFINITY;
6225  else if(decoded == DOUBLE_NEG_INF) *dst = -INFINITY;
6226  //cppcheck-suppress redundantCondition
6227  else if((decoded >= 0x7ff0000000000001L && decoded <= 0x7fffffffffffffffL) ||
6228  (decoded >= 0xfff0000000000001L && decoded <= 0xffffffffffffffffL)) *dst = NAN;
6229  else *dst = (UA_Double)unpack754(decoded, 64, 11);
6230  return UA_STATUSCODE_GOOD;
6231 }
6232 
6233 #endif
6234 
6235 /* If encoding fails, exchange the buffer and try again. It is assumed that
6236  * encoding of numerical types never fails on a fresh buffer. */
6237 static status
6238 encodeNumericWithExchangeBuffer(const void *ptr,
6239  UA_encodeBinarySignature encodeFunc) {
6240  status ret = encodeFunc(ptr, NULL);
6242  ret = exchangeBuffer();
6243  if(ret != UA_STATUSCODE_GOOD)
6244  return ret;
6245  encodeFunc(ptr, NULL);
6246  }
6247  return UA_STATUSCODE_GOOD;
6248 }
6249 
6250 /* If the type is more complex, wrap encoding into the following method to
6251  * ensure that the buffer is exchanged with intermediate checkpoints. */
6252 static status
6253 UA_encodeBinaryInternal(const void *src, const UA_DataType *type);
6254 
6255 /******************/
6256 /* Array Handling */
6257 /******************/
6258 
6259 static status
6260 Array_encodeBinaryOverlayable(uintptr_t ptr, size_t length, size_t elementMemSize) {
6261  /* Store the number of already encoded elements */
6262  size_t finished = 0;
6263 
6264  /* Loop as long as more elements remain than fit into the chunk */
6265  while(g_end < g_pos + (elementMemSize * (length-finished))) {
6266  size_t possible = ((uintptr_t)g_end - (uintptr_t)g_pos) / (sizeof(u8) * elementMemSize);
6267  size_t possibleMem = possible * elementMemSize;
6268  memcpy(g_pos, (void*)ptr, possibleMem);
6269  g_pos += possibleMem;
6270  ptr += possibleMem;
6271  finished += possible;
6272  status ret = exchangeBuffer();
6273  if(ret != UA_STATUSCODE_GOOD)
6274  return ret;
6275  }
6276 
6277  /* Encode the remaining elements */
6278  memcpy(g_pos, (void*)ptr, elementMemSize * (length-finished));
6279  g_pos += elementMemSize * (length-finished);
6280  return UA_STATUSCODE_GOOD;
6281 }
6282 
6283 static status
6284 Array_encodeBinaryComplex(uintptr_t ptr, size_t length, const UA_DataType *type) {
6285  /* Get the encoding function for the data type. The jumptable at
6286  * UA_BUILTIN_TYPES_COUNT points to the generic UA_encodeBinary method */
6287  size_t encode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
6288  UA_encodeBinarySignature encodeType = encodeBinaryJumpTable[encode_index];
6289 
6290  /* Encode every element */
6291  for(size_t i = 0; i < length; ++i) {
6292  u8 *oldpos = g_pos;
6293  status ret = encodeType((const void*)ptr, type);
6294  ptr += type->memSize;
6295  /* Encoding failed, switch to the next chunk when possible */
6296  if(ret != UA_STATUSCODE_GOOD) {
6298  g_pos = oldpos; /* Set buffer position to the end of the last encoded element */
6299  ret = exchangeBuffer();
6300  ptr -= type->memSize; /* Undo to retry encoding the ith element */
6301  --i;
6302  }
6304  if(ret != UA_STATUSCODE_GOOD)
6305  return ret; /* Unrecoverable fail */
6306  }
6307  }
6308  return UA_STATUSCODE_GOOD;
6309 }
6310 
6311 static status
6312 Array_encodeBinary(const void *src, size_t length, const UA_DataType *type) {
6313  /* Check and convert the array length to int32 */
6314  i32 signed_length = -1;
6315  if(length > UA_INT32_MAX)
6317  if(length > 0)
6318  signed_length = (i32)length;
6319  else if(src == UA_EMPTY_ARRAY_SENTINEL)
6320  signed_length = 0;
6321 
6322  /* Encode the array length */
6323  status ret = encodeNumericWithExchangeBuffer(&signed_length,
6324  (UA_encodeBinarySignature)UInt32_encodeBinary);
6325 
6326  /* Quit early? */
6327  if(ret != UA_STATUSCODE_GOOD || length == 0)
6328  return ret;
6329 
6330  /* Encode the content */
6331  if(!type->overlayable)
6332  return Array_encodeBinaryComplex((uintptr_t)src, length, type);
6333  return Array_encodeBinaryOverlayable((uintptr_t)src, length, type->memSize);
6334 }
6335 
6336 static status
6337 Array_decodeBinary(void *UA_RESTRICT *UA_RESTRICT dst,
6338  size_t *out_length, const UA_DataType *type) {
6339  /* Decode the length */
6340  i32 signed_length;
6341  status ret = Int32_decodeBinary(&signed_length);
6342  if(ret != UA_STATUSCODE_GOOD)
6343  return ret;
6344 
6345  /* Return early for empty arrays */
6346  if(signed_length <= 0) {
6347  *out_length = 0;
6348  if(signed_length < 0)
6349  *dst = NULL;
6350  else
6351  *dst = UA_EMPTY_ARRAY_SENTINEL;
6352  return UA_STATUSCODE_GOOD;
6353  }
6354 
6355  /* Filter out arrays that can obviously not be decoded, because the message
6356  * is too small for the array length. This prevents the allocation of very
6357  * long arrays for bogus messages.*/
6358  size_t length = (size_t)signed_length;
6359  if(g_pos + ((type->memSize * length) / 32) > g_end)
6361 
6362  /* Allocate memory */
6363  *dst = UA_calloc(length, type->memSize);
6364  if(!*dst)
6366 
6367  if(type->overlayable) {
6368  /* memcpy overlayable array */
6369  if(g_end < g_pos + (type->memSize * length)) {
6370  UA_free(*dst);
6371  *dst = NULL;
6373  }
6374  memcpy(*dst, g_pos, type->memSize * length);
6375  g_pos += type->memSize * length;
6376  } else {
6377  /* Decode array members */
6378  uintptr_t ptr = (uintptr_t)*dst;
6379  size_t decode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
6380  for(size_t i = 0; i < length; ++i) {
6381  ret = decodeBinaryJumpTable[decode_index]((void*)ptr, type);
6382  if(ret != UA_STATUSCODE_GOOD) {
6383  // +1 because last element is also already initialized
6384  UA_Array_delete(*dst, i+1, type);
6385  *dst = NULL;
6386  return ret;
6387  }
6388  ptr += type->memSize;
6389  }
6390  }
6391  *out_length = length;
6392  return UA_STATUSCODE_GOOD;
6393 }
6394 
6395 /*****************/
6396 /* Builtin Types */
6397 /*****************/
6398 
6399 static status
6400 String_encodeBinary(UA_String const *src, const UA_DataType *_) {
6401  return Array_encodeBinary(src->data, src->length, &UA_TYPES[UA_TYPES_BYTE]);
6402 }
6403 
6404 static status
6405 String_decodeBinary(UA_String *dst, const UA_DataType *_) {
6406  return Array_decodeBinary((void**)&dst->data, &dst->length, &UA_TYPES[UA_TYPES_BYTE]);
6407 }
6408 
6409 static UA_INLINE status
6410 ByteString_encodeBinary(UA_ByteString const *src) {
6411  return String_encodeBinary((const UA_String*)src, NULL);
6412 }
6413 
6414 static UA_INLINE status
6415 ByteString_decodeBinary(UA_ByteString *dst) {
6416  return String_decodeBinary((UA_ByteString*)dst, NULL);
6417 }
6418 
6419 /* Guid */
6420 static status
6421 Guid_encodeBinary(UA_Guid const *src, const UA_DataType *_) {
6422  status ret = UInt32_encodeBinary(&src->data1, NULL);
6423  ret |= UInt16_encodeBinary(&src->data2, NULL);
6424  ret |= UInt16_encodeBinary(&src->data3, NULL);
6425  if(g_pos + (8*sizeof(u8)) > g_end)
6427  memcpy(g_pos, src->data4, 8*sizeof(u8));
6428  g_pos += 8;
6429  return ret;
6430 }
6431 
6432 static status
6433 Guid_decodeBinary(UA_Guid *dst, const UA_DataType *_) {
6434  status ret = UInt32_decodeBinary(&dst->data1, NULL);
6435  ret |= UInt16_decodeBinary(&dst->data2, NULL);
6436  ret |= UInt16_decodeBinary(&dst->data3, NULL);
6437  if(g_pos + (8*sizeof(u8)) > g_end)
6439  memcpy(dst->data4, g_pos, 8*sizeof(u8));
6440  g_pos += 8;
6441  return ret;
6442 }
6443 
6444 /* NodeId */
6445 #define UA_NODEIDTYPE_NUMERIC_TWOBYTE 0
6446 #define UA_NODEIDTYPE_NUMERIC_FOURBYTE 1
6447 #define UA_NODEIDTYPE_NUMERIC_COMPLETE 2
6448 
6449 #define UA_EXPANDEDNODEID_SERVERINDEX_FLAG 0x40
6450 #define UA_EXPANDEDNODEID_NAMESPACEURI_FLAG 0x80
6451 
6452 /* For ExpandedNodeId, we prefill the encoding mask. We can return
6453  * UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED before encoding the string, as the
6454  * buffer is not replaced. */
6455 static status
6456 NodeId_encodeBinaryWithEncodingMask(UA_NodeId const *src, u8 encoding) {
6457  status ret = UA_STATUSCODE_GOOD;
6458  switch(src->identifierType) {
6459  case UA_NODEIDTYPE_NUMERIC:
6461  encoding |= UA_NODEIDTYPE_NUMERIC_COMPLETE;
6462  ret |= Byte_encodeBinary(&encoding, NULL);
6463  ret |= UInt16_encodeBinary(&src->namespaceIndex, NULL);
6464  ret |= UInt32_encodeBinary(&src->identifier.numeric, NULL);
6465  } else if(src->identifier.numeric > UA_BYTE_MAX || src->namespaceIndex > 0) {
6466  encoding |= UA_NODEIDTYPE_NUMERIC_FOURBYTE;
6467  ret |= Byte_encodeBinary(&encoding, NULL);
6468  u8 nsindex = (u8)src->namespaceIndex;
6469  ret |= Byte_encodeBinary(&nsindex, NULL);
6470  u16 identifier16 = (u16)src->identifier.numeric;
6471  ret |= UInt16_encodeBinary(&identifier16, NULL);
6472  } else {
6473  encoding |= UA_NODEIDTYPE_NUMERIC_TWOBYTE;
6474  ret |= Byte_encodeBinary(&encoding, NULL);
6475  u8 identifier8 = (u8)src->identifier.numeric;
6476  ret |= Byte_encodeBinary(&identifier8, NULL);
6477  }
6478  break;
6479  case UA_NODEIDTYPE_STRING:
6480  encoding |= UA_NODEIDTYPE_STRING;
6481  ret |= Byte_encodeBinary(&encoding, NULL);
6482  ret |= UInt16_encodeBinary(&src->namespaceIndex, NULL);
6483  if(ret != UA_STATUSCODE_GOOD)
6484  return ret;
6485  ret = String_encodeBinary(&src->identifier.string, NULL);
6486  break;
6487  case UA_NODEIDTYPE_GUID:
6488  encoding |= UA_NODEIDTYPE_GUID;
6489  ret |= Byte_encodeBinary(&encoding, NULL);
6490  ret |= UInt16_encodeBinary(&src->namespaceIndex, NULL);
6491  ret |= Guid_encodeBinary(&src->identifier.guid, NULL);
6492  break;
6494  encoding |= UA_NODEIDTYPE_BYTESTRING;
6495  ret |= Byte_encodeBinary(&encoding, NULL);
6496  ret |= UInt16_encodeBinary(&src->namespaceIndex, NULL);
6497  if(ret != UA_STATUSCODE_GOOD)
6498  return ret;
6499  ret = ByteString_encodeBinary(&src->identifier.byteString);
6500  break;
6501  default:
6503  }
6504  return ret;
6505 }
6506 
6507 static status
6508 NodeId_encodeBinary(UA_NodeId const *src, const UA_DataType *_) {
6509  return NodeId_encodeBinaryWithEncodingMask(src, 0);
6510 }
6511 
6512 static status
6513 NodeId_decodeBinary(UA_NodeId *dst, const UA_DataType *_) {
6514  u8 dstByte = 0, encodingByte = 0;
6515  u16 dstUInt16 = 0;
6516 
6517  /* Decode the encoding bitfield */
6518  status ret = Byte_decodeBinary(&encodingByte, NULL);
6519  if(ret != UA_STATUSCODE_GOOD)
6520  return ret;
6521 
6522  /* Filter out the bits used only for ExpandedNodeIds */
6523  encodingByte &= (u8)~(UA_EXPANDEDNODEID_SERVERINDEX_FLAG |
6525 
6526  /* Decode the namespace and identifier */
6527  switch (encodingByte) {
6530  ret = Byte_decodeBinary(&dstByte, NULL);
6531  dst->identifier.numeric = dstByte;
6532  dst->namespaceIndex = 0;
6533  break;
6536  ret |= Byte_decodeBinary(&dstByte, NULL);
6537  dst->namespaceIndex = dstByte;
6538  ret |= UInt16_decodeBinary(&dstUInt16, NULL);
6539  dst->identifier.numeric = dstUInt16;
6540  break;
6543  ret |= UInt16_decodeBinary(&dst->namespaceIndex, NULL);
6544  ret |= UInt32_decodeBinary(&dst->identifier.numeric, NULL);
6545  break;
6546  case UA_NODEIDTYPE_STRING:
6548  ret |= UInt16_decodeBinary(&dst->namespaceIndex, NULL);
6549  ret |= String_decodeBinary(&dst->identifier.string, NULL);
6550  break;
6551  case UA_NODEIDTYPE_GUID:
6553  ret |= UInt16_decodeBinary(&dst->namespaceIndex, NULL);
6554  ret |= Guid_decodeBinary(&dst->identifier.guid, NULL);
6555  break;
6558  ret |= UInt16_decodeBinary(&dst->namespaceIndex, NULL);
6559  ret |= ByteString_decodeBinary(&dst->identifier.byteString);
6560  break;
6561  default:
6563  break;
6564  }
6565  return ret;
6566 }
6567 
6568 /* ExpandedNodeId */
6569 static status
6570 ExpandedNodeId_encodeBinary(UA_ExpandedNodeId const *src, const UA_DataType *_) {
6571  /* Set up the encoding mask */
6572  u8 encoding = 0;
6573  if((void*)src->namespaceUri.data > UA_EMPTY_ARRAY_SENTINEL)
6575  if(src->serverIndex > 0)
6577 
6578  /* Encode the NodeId */
6579  status ret = NodeId_encodeBinaryWithEncodingMask(&src->nodeId, encoding);
6580  if(ret != UA_STATUSCODE_GOOD)
6581  return ret;
6582 
6583  /* Encode the namespace. Do not return
6584  * UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED afterwards. */
6585  if((void*)src->namespaceUri.data > UA_EMPTY_ARRAY_SENTINEL) {
6586  ret = String_encodeBinary(&src->namespaceUri, NULL);
6588  if(ret != UA_STATUSCODE_GOOD)
6589  return ret;
6590  }
6591 
6592  /* Encode the serverIndex */
6593  if(src->serverIndex > 0)
6594  ret = encodeNumericWithExchangeBuffer(&src->serverIndex,
6595  (UA_encodeBinarySignature)UInt32_encodeBinary);
6597  return ret;
6598 }
6599 
6600 static status
6601 ExpandedNodeId_decodeBinary(UA_ExpandedNodeId *dst, const UA_DataType *_) {
6602  /* Decode the encoding mask */
6603  if(g_pos >= g_end)
6605  u8 encoding = *g_pos;
6606 
6607  /* Decode the NodeId */
6608  status ret = NodeId_decodeBinary(&dst->nodeId, NULL);
6609 
6610  /* Decode the NamespaceUri */
6611  if(encoding & UA_EXPANDEDNODEID_NAMESPACEURI_FLAG) {
6612  dst->nodeId.namespaceIndex = 0;
6613  ret |= String_decodeBinary(&dst->namespaceUri, NULL);
6614  }
6615 
6616  /* Decode the ServerIndex */
6617  if(encoding & UA_EXPANDEDNODEID_SERVERINDEX_FLAG)
6618  ret |= UInt32_decodeBinary(&dst->serverIndex, NULL);
6619  return ret;
6620 }
6621 
6622 /* LocalizedText */
6623 #define UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_LOCALE 0x01
6624 #define UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_TEXT 0x02
6625 
6626 static status
6627 LocalizedText_encodeBinary(UA_LocalizedText const *src, const UA_DataType *_) {
6628  /* Set up the encoding mask */
6629  u8 encoding = 0;
6630  if(src->locale.data)
6632  if(src->text.data)
6634 
6635  /* Encode the encoding byte */
6636  status ret = Byte_encodeBinary(&encoding, NULL);
6637  if(ret != UA_STATUSCODE_GOOD)
6638  return ret;
6639 
6640  /* Encode the strings */
6642  ret |= String_encodeBinary(&src->locale, NULL);
6644  ret |= String_encodeBinary(&src->text, NULL);
6646  return ret;
6647 }
6648 
6649 static status
6650 LocalizedText_decodeBinary(UA_LocalizedText *dst, const UA_DataType *_) {
6651  /* Decode the encoding mask */
6652  u8 encoding = 0;
6653  status ret = Byte_decodeBinary(&encoding, NULL);
6654 
6655  /* Decode the content */
6657  ret |= String_decodeBinary(&dst->locale, NULL);
6659  ret |= String_decodeBinary(&dst->text, NULL);
6660  return ret;
6661 }
6662 
6663 /* The binary encoding has a different nodeid from the data type. So it is not
6664  * possible to reuse UA_findDataType */
6665 static const UA_DataType *
6666 UA_findDataTypeByBinary(const UA_NodeId *typeId) {
6667  /* We only store a numeric identifier for the encoding nodeid of data types */
6668  if(typeId->identifierType != UA_NODEIDTYPE_NUMERIC)
6669  return NULL;
6670 
6671  /* Iterate over the array */
6672  for(size_t i = 0; i < UA_TYPES_COUNT; ++i) {
6673  if(UA_TYPES[i].binaryEncodingId == typeId->identifier.numeric &&
6675  return &UA_TYPES[i];
6676  }
6677  return NULL;
6678 }
6679 
6680 /* ExtensionObject */
6681 static status
6682 ExtensionObject_encodeBinary(UA_ExtensionObject const *src, const UA_DataType *_) {
6683  u8 encoding = src->encoding;
6684 
6685  /* No content or already encoded content. Do not return
6686  * UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED after encoding the NodeId. */
6687  if(encoding <= UA_EXTENSIONOBJECT_ENCODED_XML) {
6688  status ret = NodeId_encodeBinary(&src->content.encoded.typeId, NULL);
6689  if(ret != UA_STATUSCODE_GOOD)
6690  return ret;
6691  ret = encodeNumericWithExchangeBuffer(&encoding,
6692  (UA_encodeBinarySignature)Byte_encodeBinary);
6693  if(ret != UA_STATUSCODE_GOOD)
6694  return ret;
6695  switch (src->encoding) {
6697  break;
6700  ret = ByteString_encodeBinary(&src->content.encoded.body);
6701  break;
6702  default:
6704  }
6705  return ret;
6706  }
6707 
6708  /* Cannot encode with no data or no type description */
6709  if(!src->content.decoded.type || !src->content.decoded.data)
6711 
6712  /* Write the NodeId for the binary encoded type. The NodeId is always
6713  * numeric, so no buffer replacement is taking place. */
6714  UA_NodeId typeId = src->content.decoded.type->typeId;
6717  typeId.identifier.numeric = src->content.decoded.type->binaryEncodingId;
6718  status ret = NodeId_encodeBinary(&typeId, NULL);
6719 
6720  /* Write the encoding byte */
6722  ret |= Byte_encodeBinary(&encoding, NULL);
6723 
6724  /* Compute the content length */
6725  const UA_DataType *type = src->content.decoded.type;
6726  size_t len = UA_calcSizeBinary(src->content.decoded.data, type);
6727 
6728  /* Encode the content length */
6729  if(len > UA_INT32_MAX)
6731  i32 signed_len = (i32)len;
6732  ret |= Int32_encodeBinary(&signed_len);
6733 
6734  /* Return early upon failures (no buffer exchange until here) */
6735  if(ret != UA_STATUSCODE_GOOD)
6736  return ret;
6737 
6738  /* Encode the content */
6739  return UA_encodeBinaryInternal(src->content.decoded.data, type);
6740 }
6741 
6742 static status
6743 ExtensionObject_decodeBinaryContent(UA_ExtensionObject *dst, const UA_NodeId *typeId) {
6744  /* Lookup the datatype */
6745  const UA_DataType *type = UA_findDataTypeByBinary(typeId);
6746 
6747  /* Unknown type, just take the binary content */
6748  if(!type) {
6750  UA_NodeId_copy(typeId, &dst->content.encoded.typeId);
6751  return ByteString_decodeBinary(&dst->content.encoded.body);
6752  }
6753 
6754  /* Allocate memory */
6755  dst->content.decoded.data = UA_new(type);
6756  if(!dst->content.decoded.data)
6758 
6759  /* Jump over the length field (TODO: check if the decoded length matches) */
6760  g_pos += 4;
6761 
6762  /* Decode */
6764  dst->content.decoded.type = type;
6765  size_t decode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
6766  return decodeBinaryJumpTable[decode_index](dst->content.decoded.data, type);
6767 }
6768 
6769 static status
6770 ExtensionObject_decodeBinary(UA_ExtensionObject *dst, const UA_DataType *_) {
6771  u8 encoding = 0;
6772  UA_NodeId binTypeId; /* Can contain a string nodeid. But no corresponding
6773  * type is then found in open62541. We only store
6774  * numerical nodeids of the binary encoding identifier.
6775  * The extenionobject will be decoded to contain a
6776  * binary blob. */
6777  UA_NodeId_init(&binTypeId);
6778  status ret = NodeId_decodeBinary(&binTypeId, NULL);
6779  ret |= Byte_decodeBinary(&encoding, NULL);
6780  if(ret != UA_STATUSCODE_GOOD) {
6781  UA_NodeId_deleteMembers(&binTypeId);
6782  return ret;
6783  }
6784 
6785  if(encoding == UA_EXTENSIONOBJECT_ENCODED_BYTESTRING) {
6786  ret = ExtensionObject_decodeBinaryContent(dst, &binTypeId);
6787  UA_NodeId_deleteMembers(&binTypeId);
6788  } else if(encoding == UA_EXTENSIONOBJECT_ENCODED_NOBODY) {
6789  dst->encoding = (UA_ExtensionObjectEncoding)encoding;
6790  dst->content.encoded.typeId = binTypeId; /* move to dst */
6791  dst->content.encoded.body = UA_BYTESTRING_NULL;
6792  } else if(encoding == UA_EXTENSIONOBJECT_ENCODED_XML) {
6793  dst->encoding = (UA_ExtensionObjectEncoding)encoding;
6794  dst->content.encoded.typeId = binTypeId; /* move to dst */
6795  ret = ByteString_decodeBinary(&dst->content.encoded.body);
6796  if(ret != UA_STATUSCODE_GOOD)
6797  UA_NodeId_deleteMembers(&dst->content.encoded.typeId);
6798  } else {
6799  UA_NodeId_deleteMembers(&binTypeId);
6801  }
6802 
6803  return ret;
6804 }
6805 
6806 /* Variant */
6807 
6808 /* Never returns UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED */
6809 static status
6810 Variant_encodeBinaryWrapExtensionObject(const UA_Variant *src, const bool isArray) {
6811  /* Default to 1 for a scalar. */
6812  size_t length = 1;
6813 
6814  /* Encode the array length if required */
6815  status ret = UA_STATUSCODE_GOOD;
6816  if(isArray) {
6817  if(src->arrayLength > UA_INT32_MAX)
6819  length = src->arrayLength;
6820  i32 encodedLength = (i32)src->arrayLength;
6821  ret = Int32_encodeBinary(&encodedLength);
6822  if(ret != UA_STATUSCODE_GOOD)
6823  return ret;
6824  }
6825 
6826  /* Set up the ExtensionObject */
6827  UA_ExtensionObject eo;
6828  UA_ExtensionObject_init(&eo);
6830  eo.content.decoded.type = src->type;
6831  const u16 memSize = src->type->memSize;
6832  uintptr_t ptr = (uintptr_t)src->data;
6833 
6834  /* Iterate over the array */
6835  for(size_t i = 0; i < length && ret == UA_STATUSCODE_GOOD; ++i) {
6836  eo.content.decoded.data = (void*)ptr;
6837  ret = UA_encodeBinaryInternal(&eo, &UA_TYPES[UA_TYPES_EXTENSIONOBJECT]);
6838  ptr += memSize;
6839  }
6840  return ret;
6841 }
6842 
6846  UA_VARIANT_ENCODINGMASKTYPE_ARRAY = (0x01 << 7) // bit 7
6847 };
6848 
6849 static status
6850 Variant_encodeBinary(const UA_Variant *src, const UA_DataType *_) {
6851  /* Quit early for the empty variant */
6852  u8 encoding = 0;
6853  if(!src->type)
6854  return Byte_encodeBinary(&encoding, NULL);
6855 
6856  /* Set the content type in the encoding mask */
6857  const bool isBuiltin = src->type->builtin;
6858  if(isBuiltin)
6859  encoding |= UA_VARIANT_ENCODINGMASKTYPE_TYPEID_MASK & (u8)(src->type->typeIndex + 1);
6860  else
6862 
6863  /* Set the array type in the encoding mask */
6864  const bool isArray = src->arrayLength > 0 || src->data <= UA_EMPTY_ARRAY_SENTINEL;
6865  const bool hasDimensions = isArray && src->arrayDimensionsSize > 0;
6866  if(isArray) {
6868  if(hasDimensions)
6870  }
6871 
6872  /* Encode the encoding byte */
6873  status ret = Byte_encodeBinary(&encoding, NULL);
6874  if(ret != UA_STATUSCODE_GOOD)
6875  return ret;
6876 
6877  /* Encode the content */
6878  if(!isBuiltin)
6879  ret = Variant_encodeBinaryWrapExtensionObject(src, isArray);
6880  else if(!isArray)
6881  ret = UA_encodeBinaryInternal(src->data, src->type);
6882  else
6883  ret = Array_encodeBinary(src->data, src->arrayLength, src->type);
6884 
6885  /* Encode the array dimensions */
6886  if(hasDimensions && ret == UA_STATUSCODE_GOOD)
6887  ret = Array_encodeBinary(src->arrayDimensions, src->arrayDimensionsSize,
6889  return ret;
6890 }
6891 
6892 static status
6893 Variant_decodeBinaryUnwrapExtensionObject(UA_Variant *dst) {
6894  /* Save the position in the ByteString. If unwrapping is not possible, start
6895  * from here to decode a normal ExtensionObject. */
6896  u8 *old_pos = g_pos;
6897 
6898  /* Decode the DataType */
6899  UA_NodeId typeId;
6900  UA_NodeId_init(&typeId);
6901  status ret = NodeId_decodeBinary(&typeId, NULL);
6902  if(ret != UA_STATUSCODE_GOOD)
6903  return ret;
6904 
6905  /* Decode the EncodingByte */
6906  u8 encoding;
6907  ret = Byte_decodeBinary(&encoding, NULL);
6908  if(ret != UA_STATUSCODE_GOOD) {
6909  UA_NodeId_deleteMembers(&typeId);
6910  return ret;
6911  }
6912 
6913  /* Search for the datatype. Default to ExtensionObject. */
6914  if(encoding == UA_EXTENSIONOBJECT_ENCODED_BYTESTRING &&
6915  (dst->type = UA_findDataTypeByBinary(&typeId)) != NULL) {
6916  /* Jump over the length field (TODO: check if length matches) */
6917  g_pos += 4;
6918  } else {
6919  /* Reset and decode as ExtensionObject */
6921  g_pos = old_pos;
6922  UA_NodeId_deleteMembers(&typeId);
6923  }
6924 
6925  /* Allocate memory */
6926  dst->data = UA_new(dst->type);
6927  if(!dst->data)
6929 
6930  /* Decode the content */
6931  size_t decode_index = dst->type->builtin ? dst->type->typeIndex : UA_BUILTIN_TYPES_COUNT;
6932  return decodeBinaryJumpTable[decode_index](dst->data, dst->type);
6933 }
6934 
6935 /* The resulting variant always has the storagetype UA_VARIANT_DATA. */
6936 static status
6937 Variant_decodeBinary(UA_Variant *dst, const UA_DataType *_) {
6938  /* Decode the encoding byte */
6939  u8 encodingByte;
6940  status ret = Byte_decodeBinary(&encodingByte, NULL);
6941  if(ret != UA_STATUSCODE_GOOD)
6942  return ret;
6943 
6944  /* Return early for an empty variant (was already _inited) */
6945  if(encodingByte == 0)
6946  return UA_STATUSCODE_GOOD;
6947 
6948  /* Does the variant contain an array? */
6949  const bool isArray = (encodingByte & UA_VARIANT_ENCODINGMASKTYPE_ARRAY) > 0;
6950 
6951  /* Get the datatype of the content. The type must be a builtin data type.
6952  * All not-builtin types are wrapped in an ExtensionObject.
6953  * The content can not be a variant again, otherwise we may run into a stack overflow problem.
6954  * See: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4233 */
6955  size_t typeIndex = (size_t)((encodingByte & UA_VARIANT_ENCODINGMASKTYPE_TYPEID_MASK) - 1);
6956  if(typeIndex > UA_TYPES_DIAGNOSTICINFO || typeIndex == UA_TYPES_VARIANT)
6958  dst->type = &UA_TYPES[typeIndex];
6959 
6960  /* Decode the content */
6961  if(isArray) {
6962  ret = Array_decodeBinary(&dst->data, &dst->arrayLength, dst->type);
6963  } else if(typeIndex != UA_TYPES_EXTENSIONOBJECT) {
6964  dst->data = UA_new(dst->type);
6965  if(!dst->data)
6967  ret = decodeBinaryJumpTable[typeIndex](dst->data, dst->type);
6968  } else {
6969  ret = Variant_decodeBinaryUnwrapExtensionObject(dst);
6970  }
6971 
6972  /* Decode array dimensions */
6973  if(isArray && (encodingByte & UA_VARIANT_ENCODINGMASKTYPE_DIMENSIONS) > 0)
6974  ret |= Array_decodeBinary((void**)&dst->arrayDimensions,
6976  return ret;
6977 }
6978 
6979 /* DataValue */
6980 static status
6981 DataValue_encodeBinary(UA_DataValue const *src, const UA_DataType *_) {
6982  /* Set up the encoding mask */
6983  u8 encodingMask = (u8)
6984  (((u8)src->hasValue) |
6985  ((u8)src->hasStatus << 1) |
6986  ((u8)src->hasSourceTimestamp << 2) |
6987  ((u8)src->hasServerTimestamp << 3) |
6988  ((u8)src->hasSourcePicoseconds << 4) |
6989  ((u8)src->hasServerPicoseconds << 5));
6990 
6991  /* Encode the encoding byte */
6992  status ret = Byte_encodeBinary(&encodingMask, NULL);
6993  if(ret != UA_STATUSCODE_GOOD)
6994  return ret;
6995 
6996  /* Encode the variant. Afterwards, do not return
6997  * UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED, as the buffer might have been
6998  * exchanged during encoding of the variant. */
6999  if(src->hasValue) {
7000  ret = Variant_encodeBinary(&src->value, NULL);
7001  if(ret != UA_STATUSCODE_GOOD)
7002  return ret;
7003  }
7004 
7005  if(src->hasStatus)
7006  ret |= encodeNumericWithExchangeBuffer(&src->status,
7007  (UA_encodeBinarySignature)UInt32_encodeBinary);
7008  if(src->hasSourceTimestamp)
7009  ret |= encodeNumericWithExchangeBuffer(&src->sourceTimestamp,
7010  (UA_encodeBinarySignature)UInt64_encodeBinary);
7011  if(src->hasSourcePicoseconds)
7012  ret |= encodeNumericWithExchangeBuffer(&src->sourcePicoseconds,
7013  (UA_encodeBinarySignature)UInt16_encodeBinary);
7014  if(src->hasServerTimestamp)
7015  ret |= encodeNumericWithExchangeBuffer(&src->serverTimestamp,
7016  (UA_encodeBinarySignature)UInt64_encodeBinary);
7017  if(src->hasServerPicoseconds)
7018  ret |= encodeNumericWithExchangeBuffer(&src->serverPicoseconds,
7019  (UA_encodeBinarySignature)UInt16_encodeBinary);
7021  return ret;
7022 }
7023 
7024 #define MAX_PICO_SECONDS 9999
7025 
7026 static status
7027 DataValue_decodeBinary(UA_DataValue *dst, const UA_DataType *_) {
7028  /* Decode the encoding mask */
7029  u8 encodingMask;
7030  status ret = Byte_decodeBinary(&encodingMask, NULL);
7031  if(ret != UA_STATUSCODE_GOOD)
7032  return ret;
7033 
7034  /* Decode the content */
7035  if(encodingMask & 0x01) {
7036  dst->hasValue = true;
7037  ret |= Variant_decodeBinary(&dst->value, NULL);
7038  }
7039  if(encodingMask & 0x02) {
7040  dst->hasStatus = true;
7041  ret |= StatusCode_decodeBinary(&dst->status);
7042  }
7043  if(encodingMask & 0x04) {
7044  dst->hasSourceTimestamp = true;
7045  ret |= DateTime_decodeBinary(&dst->sourceTimestamp);
7046  }
7047  if(encodingMask & 0x10) {
7048  dst->hasSourcePicoseconds = true;
7049  ret |= UInt16_decodeBinary(&dst->sourcePicoseconds, NULL);
7052  }
7053  if(encodingMask & 0x08) {
7054  dst->hasServerTimestamp = true;
7055  ret |= DateTime_decodeBinary(&dst->serverTimestamp);
7056  }
7057  if(encodingMask & 0x20) {
7058  dst->hasServerPicoseconds = true;
7059  ret |= UInt16_decodeBinary(&dst->serverPicoseconds, NULL);
7062  }
7063  return ret;
7064 }
7065 
7066 /* DiagnosticInfo */
7067 static status
7068 DiagnosticInfo_encodeBinary(const UA_DiagnosticInfo *src, const UA_DataType *_) {
7069  /* Set up the encoding mask */
7070  u8 encodingMask = (u8)
7071  ((u8)src->hasSymbolicId | ((u8)src->hasNamespaceUri << 1) |
7072  ((u8)src->hasLocalizedText << 2) | ((u8)src->hasLocale << 3) |
7073  ((u8)src->hasAdditionalInfo << 4) | ((u8)src->hasInnerDiagnosticInfo << 5));
7074 
7075  /* Encode the numeric content */
7076  status ret = Byte_encodeBinary(&encodingMask, NULL);
7077  if(src->hasSymbolicId)
7078  ret |= Int32_encodeBinary(&src->symbolicId);
7079  if(src->hasNamespaceUri)
7080  ret |= Int32_encodeBinary(&src->namespaceUri);
7081  if(src->hasLocalizedText)
7082  ret |= Int32_encodeBinary(&src->localizedText);
7083  if(src->hasLocale)
7084  ret |= Int32_encodeBinary(&src->locale);
7085  if(ret != UA_STATUSCODE_GOOD)
7086  return ret;
7087 
7088  /* Encode the additional info */
7089  if(src->hasAdditionalInfo) {
7090  ret = String_encodeBinary(&src->additionalInfo, NULL);
7091  if(ret != UA_STATUSCODE_GOOD)
7092  return ret;
7093  }
7094 
7095  /* From here on, do not return UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED, as
7096  * the buffer might have been exchanged during encoding of the string. */
7097 
7098  /* Encode the inner status code */
7099  if(src->hasInnerStatusCode) {
7100  ret = encodeNumericWithExchangeBuffer(&src->innerStatusCode,
7101  (UA_encodeBinarySignature)UInt32_encodeBinary);
7103  if(ret != UA_STATUSCODE_GOOD)
7104  return ret;
7105  }
7106 
7107  /* Encode the inner diagnostic info */
7108  if(src->hasInnerDiagnosticInfo)
7109  ret = UA_encodeBinaryInternal(src->innerDiagnosticInfo,
7111 
7113  return ret;
7114 }
7115 
7116 static status
7117 DiagnosticInfo_decodeBinary(UA_DiagnosticInfo *dst, const UA_DataType *_) {
7118  /* Decode the encoding mask */
7119  u8 encodingMask;
7120  status ret = Byte_decodeBinary(&encodingMask, NULL);
7121  if(ret != UA_STATUSCODE_GOOD)
7122  return ret;
7123 
7124  /* Decode the content */
7125  if(encodingMask & 0x01) {
7126  dst->hasSymbolicId = true;
7127  ret |= Int32_decodeBinary(&dst->symbolicId);
7128  }
7129  if(encodingMask & 0x02) {
7130  dst->hasNamespaceUri = true;
7131  ret |= Int32_decodeBinary(&dst->namespaceUri);
7132  }
7133  if(encodingMask & 0x04) {
7134  dst->hasLocalizedText = true;
7135  ret |= Int32_decodeBinary(&dst->localizedText);
7136  }
7137  if(encodingMask & 0x08) {
7138  dst->hasLocale = true;
7139  ret |= Int32_decodeBinary(&dst->locale);
7140  }
7141  if(encodingMask & 0x10) {
7142  dst->hasAdditionalInfo = true;
7143  ret |= String_decodeBinary(&dst->additionalInfo, NULL);
7144  }
7145  if(encodingMask & 0x20) {
7146  dst->hasInnerStatusCode = true;
7147  ret |= StatusCode_decodeBinary(&dst->innerStatusCode);
7148  }
7149  if(encodingMask & 0x40) {
7150  /* innerDiagnosticInfo is allocated on the heap */
7152  UA_calloc(1, sizeof(UA_DiagnosticInfo));
7153  if(!dst->innerDiagnosticInfo)
7155  dst->hasInnerDiagnosticInfo = true;
7156  ret |= DiagnosticInfo_decodeBinary(dst->innerDiagnosticInfo, NULL);
7157  }
7158  return ret;
7159 }
7160 
7161 /********************/
7162 /* Structured Types */
7163 /********************/
7164 
7165 static status
7166 UA_decodeBinaryInternal(void *dst, const UA_DataType *type);
7167 
7168 const UA_encodeBinarySignature encodeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = {
7169  (UA_encodeBinarySignature)Boolean_encodeBinary,
7170  (UA_encodeBinarySignature)Byte_encodeBinary, // SByte
7171  (UA_encodeBinarySignature)Byte_encodeBinary,
7172  (UA_encodeBinarySignature)UInt16_encodeBinary, // Int16
7173  (UA_encodeBinarySignature)UInt16_encodeBinary,
7174  (UA_encodeBinarySignature)UInt32_encodeBinary, // Int32
7175  (UA_encodeBinarySignature)UInt32_encodeBinary,
7176  (UA_encodeBinarySignature)UInt64_encodeBinary, // Int64
7177  (UA_encodeBinarySignature)UInt64_encodeBinary,
7178  (UA_encodeBinarySignature)Float_encodeBinary,
7179  (UA_encodeBinarySignature)Double_encodeBinary,
7180  (UA_encodeBinarySignature)String_encodeBinary,
7181  (UA_encodeBinarySignature)UInt64_encodeBinary, // DateTime
7182  (UA_encodeBinarySignature)Guid_encodeBinary,
7183  (UA_encodeBinarySignature)String_encodeBinary, // ByteString
7184  (UA_encodeBinarySignature)String_encodeBinary, // XmlElement
7185  (UA_encodeBinarySignature)NodeId_encodeBinary,
7186  (UA_encodeBinarySignature)ExpandedNodeId_encodeBinary,
7187  (UA_encodeBinarySignature)UInt32_encodeBinary, // StatusCode
7188  (UA_encodeBinarySignature)UA_encodeBinaryInternal, // QualifiedName
7189  (UA_encodeBinarySignature)LocalizedText_encodeBinary,
7190  (UA_encodeBinarySignature)ExtensionObject_encodeBinary,
7191  (UA_encodeBinarySignature)DataValue_encodeBinary,
7192  (UA_encodeBinarySignature)Variant_encodeBinary,
7193  (UA_encodeBinarySignature)DiagnosticInfo_encodeBinary,
7194  (UA_encodeBinarySignature)UA_encodeBinaryInternal,
7195 };
7196 
7197 static status
7198 UA_encodeBinaryInternal(const void *src, const UA_DataType *type) {
7199  uintptr_t ptr = (uintptr_t)src;
7200  status ret = UA_STATUSCODE_GOOD;
7201  u8 membersSize = type->membersSize;
7202  const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
7203  for(size_t i = 0; i < membersSize && ret == UA_STATUSCODE_GOOD; ++i) {
7204  const UA_DataTypeMember *member = &type->members[i];
7205  const UA_DataType *membertype = &typelists[!member->namespaceZero][member->memberTypeIndex];
7206  if(!member->isArray) {
7207  ptr += member->padding;
7208  size_t encode_index = membertype->builtin ? membertype->typeIndex : UA_BUILTIN_TYPES_COUNT;
7209  size_t memSize = membertype->memSize;
7210  u8 *oldpos = g_pos;
7211  ret = encodeBinaryJumpTable[encode_index]((const void*)ptr, membertype);
7212  ptr += memSize;
7214  g_pos = oldpos; /* exchange/send the buffer */
7215  ret = exchangeBuffer();
7216  ptr -= member->padding + memSize; /* encode the same member in the next iteration */
7217  if(ret == UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED || g_pos + memSize > g_end) {
7218  /* the send buffer is too small to encode the member, even after exchangeBuffer */
7220  }
7221  --i;
7222  }
7223  } else {
7224  ptr += member->padding;
7225  const size_t length = *((const size_t*)ptr);
7226  ptr += sizeof(size_t);
7227  ret = Array_encodeBinary(*(void *UA_RESTRICT const *)ptr, length, membertype);
7228  ptr += sizeof(void*);
7229  }
7230  }
7232  return ret;
7233 }
7234 
7235 status
7236 UA_encodeBinary(const void *src, const UA_DataType *type,
7237  UA_exchangeEncodeBuffer exchangeCallback, void *exchangeHandle,
7238  UA_ByteString *dst, size_t *offset) {
7239  /* Set the (thread-local) pointers to save function arguments */
7240  g_buf = *dst;
7241  g_pos = &dst->data[*offset];
7242  g_end = &dst->data[dst->length];
7243  g_exchangeBufferCallback = exchangeCallback;
7244  g_exchangeBufferCallbackHandle = exchangeHandle;
7245  status ret = UA_encodeBinaryInternal(src, type);
7246 
7247  /* Set the current buffer position. Beware that the buffer might have been
7248  * exchanged internally. */
7249  *dst = g_buf;
7250  *offset = (uintptr_t)(g_pos - g_buf.data);
7251  return ret;
7252 }
7253 
7254 const UA_decodeBinarySignature decodeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = {
7255  (UA_decodeBinarySignature)Boolean_decodeBinary,
7256  (UA_decodeBinarySignature)Byte_decodeBinary, // SByte
7257  (UA_decodeBinarySignature)Byte_decodeBinary,
7258  (UA_decodeBinarySignature)UInt16_decodeBinary, // Int16
7259  (UA_decodeBinarySignature)UInt16_decodeBinary,
7260  (UA_decodeBinarySignature)UInt32_decodeBinary, // Int32
7261  (UA_decodeBinarySignature)UInt32_decodeBinary,
7262  (UA_decodeBinarySignature)UInt64_decodeBinary, // Int64
7263  (UA_decodeBinarySignature)UInt64_decodeBinary,
7264  (UA_decodeBinarySignature)Float_decodeBinary,
7265  (UA_decodeBinarySignature)Double_decodeBinary,
7266  (UA_decodeBinarySignature)String_decodeBinary,
7267  (UA_decodeBinarySignature)UInt64_decodeBinary, // DateTime
7268  (UA_decodeBinarySignature)Guid_decodeBinary,
7269  (UA_decodeBinarySignature)String_decodeBinary, // ByteString
7270  (UA_decodeBinarySignature)String_decodeBinary, // XmlElement
7271  (UA_decodeBinarySignature)NodeId_decodeBinary,
7272  (UA_decodeBinarySignature)ExpandedNodeId_decodeBinary,
7273  (UA_decodeBinarySignature)UInt32_decodeBinary, // StatusCode
7274  (UA_decodeBinarySignature)UA_decodeBinaryInternal, // QualifiedName
7275  (UA_decodeBinarySignature)LocalizedText_decodeBinary,
7276  (UA_decodeBinarySignature)ExtensionObject_decodeBinary,
7277  (UA_decodeBinarySignature)DataValue_decodeBinary,
7278  (UA_decodeBinarySignature)Variant_decodeBinary,
7279  (UA_decodeBinarySignature)DiagnosticInfo_decodeBinary,
7280  (UA_decodeBinarySignature)UA_decodeBinaryInternal
7281 };
7282 
7283 static status
7284 UA_decodeBinaryInternal(void *dst, const UA_DataType *type) {
7285  uintptr_t ptr = (uintptr_t)dst;
7286  status ret = UA_STATUSCODE_GOOD;
7287  u8 membersSize = type->membersSize;
7288  const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
7289  for(size_t i = 0; i < membersSize && ret == UA_STATUSCODE_GOOD; ++i) {
7290  const UA_DataTypeMember *member = &type->members[i];
7291  const UA_DataType *membertype = &typelists[!member->namespaceZero][member->memberTypeIndex];
7292  if(!member->isArray) {
7293  ptr += member->padding;
7294  size_t fi = membertype->builtin ? membertype->typeIndex : UA_BUILTIN_TYPES_COUNT;
7295  size_t memSize = membertype->memSize;
7296  ret |= decodeBinaryJumpTable[fi]((void *UA_RESTRICT)ptr, membertype);
7297  ptr += memSize;
7298  } else {
7299  ptr += member->padding;
7300  size_t *length = (size_t*)ptr;
7301  ptr += sizeof(size_t);
7302  ret |= Array_decodeBinary((void *UA_RESTRICT *UA_RESTRICT)ptr, length, membertype);
7303  ptr += sizeof(void*);
7304  }
7305  }
7306  return ret;
7307 }
7308 
7309 status
7310 UA_decodeBinary(const UA_ByteString *src, size_t *offset, void *dst,
7311  const UA_DataType *type) {
7312  /* Initialize the destination */
7313  memset(dst, 0, type->memSize);
7314 
7315  /* Set the (thread-local) position and end pointers to save function
7316  * arguments */
7317  g_pos = &src->data[*offset];
7318  g_end = &src->data[src->length];
7319 
7320  /* Decode */
7321  status ret = UA_decodeBinaryInternal(dst, type);
7322 
7323  /* Clean up */
7324  if(ret == UA_STATUSCODE_GOOD)
7325  *offset = (size_t)(g_pos - src->data) / sizeof(u8);
7326  else
7327  UA_deleteMembers(dst, type);
7328  return ret;
7329 }
7330 
7331 /******************/
7332 /* CalcSizeBinary */
7333 /******************/
7334 
7335 static size_t
7336 Array_calcSizeBinary(const void *src, size_t length, const UA_DataType *type) {
7337  size_t s = 4; // length
7338  if(type->overlayable) {
7339  s += type->memSize * length;
7340  return s;
7341  }
7342  uintptr_t ptr = (uintptr_t)src;
7343  size_t encode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
7344  for(size_t i = 0; i < length; ++i) {
7345  s += calcSizeBinaryJumpTable[encode_index]((const void*)ptr, type);
7346  ptr += type->memSize;
7347  }
7348  return s;
7349 }
7350 
7351 static size_t
7352 calcSizeBinaryMemSize(const void *UA_RESTRICT p, const UA_DataType *type) {
7353  return type->memSize;
7354 }
7355 
7356 static size_t
7357 String_calcSizeBinary(const UA_String *UA_RESTRICT p, const UA_DataType *_) {
7358  return 4 + p->length;
7359 }
7360 
7361 static size_t
7362 Guid_calcSizeBinary(const UA_Guid *UA_RESTRICT p, const UA_DataType *_) {
7363  return 16;
7364 }
7365 
7366 static size_t
7367 NodeId_calcSizeBinary(const UA_NodeId *UA_RESTRICT src, const UA_DataType *_) {
7368  size_t s = 1; // encoding byte
7369  switch (src->identifierType) {
7370  case UA_NODEIDTYPE_NUMERIC:
7371  if(src->identifier.numeric > UA_UINT16_MAX || src->namespaceIndex > UA_BYTE_MAX) {
7372  s += 6;
7373  } else if(src->identifier.numeric > UA_BYTE_MAX || src->namespaceIndex > 0) {
7374  s += 3;
7375  } else {
7376  s += 1;
7377  }
7378  break;
7380  case UA_NODEIDTYPE_STRING:
7381  s += 2;
7382  s += String_calcSizeBinary(&src->identifier.string, NULL);
7383  break;
7384  case UA_NODEIDTYPE_GUID:
7385  s += 18;
7386  break;
7387  default:
7388  return 0;
7389  }
7390  return s;
7391 }
7392 
7393 static size_t
7394 ExpandedNodeId_calcSizeBinary(const UA_ExpandedNodeId *src, const UA_DataType *_) {
7395  size_t s = NodeId_calcSizeBinary(&src->nodeId, NULL);
7396  if(src->namespaceUri.length > 0)
7397  s += String_calcSizeBinary(&src->namespaceUri, NULL);
7398  if(src->serverIndex > 0)
7399  s += 4;
7400  return s;
7401 }
7402 
7403 static size_t
7404 LocalizedText_calcSizeBinary(const UA_LocalizedText *src, UA_DataType *_) {
7405  size_t s = 1; // encoding byte
7406  if(src->locale.data)
7407  s += String_calcSizeBinary(&src->locale, NULL);
7408  if(src->text.data)
7409  s += String_calcSizeBinary(&src->text, NULL);
7410  return s;
7411 }
7412 
7413 static size_t
7414 ExtensionObject_calcSizeBinary(const UA_ExtensionObject *src, UA_DataType *_) {
7415  size_t s = 1; // encoding byte
7417  if(!src->content.decoded.type || !src->content.decoded.data)
7418  return 0;
7419  if(src->content.decoded.type->typeId.identifierType != UA_NODEIDTYPE_NUMERIC)
7420  return 0;
7421  s += NodeId_calcSizeBinary(&src->content.decoded.type->typeId, NULL);
7422  s += 4; // length
7423  const UA_DataType *type = src->content.decoded.type;
7424  size_t encode_index = type->builtin ? type->typeIndex : UA_BUILTIN_TYPES_COUNT;
7425  s += calcSizeBinaryJumpTable[encode_index](src->content.decoded.data, type);
7426  } else {
7427  s += NodeId_calcSizeBinary(&src->content.encoded.typeId, NULL);
7428  switch (src->encoding) {
7430  break;
7433  s += String_calcSizeBinary(&src->content.encoded.body, NULL);
7434  break;
7435  default:
7436  return 0;
7437  }
7438  }
7439  return s;
7440 }
7441 
7442 static size_t
7443 Variant_calcSizeBinary(UA_Variant const *src, UA_DataType *_) {
7444  size_t s = 1; /* encoding byte */
7445  if(!src->type)
7446  return s;
7447 
7448  bool isArray = src->arrayLength > 0 || src->data <= UA_EMPTY_ARRAY_SENTINEL;
7449  bool hasDimensions = isArray && src->arrayDimensionsSize > 0;
7450  bool isBuiltin = src->type->builtin;
7451 
7452  UA_NodeId typeId;
7453  UA_NodeId_init(&typeId);
7454  size_t encode_index = src->type->typeIndex;
7455  if(!isBuiltin) {
7456  encode_index = UA_BUILTIN_TYPES_COUNT;
7457  typeId = src->type->typeId;
7459  return 0;
7460  }
7461 
7462  size_t length = src->arrayLength;
7463  if(isArray)
7464  s += 4;
7465  else
7466  length = 1;
7467 
7468  uintptr_t ptr = (uintptr_t)src->data;
7469  size_t memSize = src->type->memSize;
7470  for(size_t i = 0; i < length; ++i) {
7471  if(!isBuiltin) {
7472  /* The type is wrapped inside an extensionobject */
7473  s += NodeId_calcSizeBinary(&typeId, NULL);
7474  s += 1 + 4; // encoding byte + length
7475  }
7476  s += calcSizeBinaryJumpTable[encode_index]((const void*)ptr, src->type);
7477  ptr += memSize;
7478  }
7479 
7480  if(hasDimensions)
7481  s += Array_calcSizeBinary(src->arrayDimensions, src->arrayDimensionsSize,
7483  return s;
7484 }
7485 
7486 static size_t
7487 DataValue_calcSizeBinary(const UA_DataValue *src, UA_DataType *_) {
7488  size_t s = 1; // encoding byte
7489  if(src->hasValue)
7490  s += Variant_calcSizeBinary(&src->value, NULL);
7491  if(src->hasStatus)
7492  s += 4;
7493  if(src->hasSourceTimestamp)
7494  s += 8;
7495  if(src->hasSourcePicoseconds)
7496  s += 2;
7497  if(src->hasServerTimestamp)
7498  s += 8;
7499  if(src->hasServerPicoseconds)
7500  s += 2;
7501  return s;
7502 }
7503 
7504 static size_t
7505 DiagnosticInfo_calcSizeBinary(const UA_DiagnosticInfo *src, UA_DataType *_) {
7506  size_t s = 1; // encoding byte
7507  if(src->hasSymbolicId)
7508  s += 4;
7509  if(src->hasNamespaceUri)
7510  s += 4;
7511  if(src->hasLocalizedText)
7512  s += 4;
7513  if(src->hasLocale)
7514  s += 4;
7515  if(src->hasAdditionalInfo)
7516  s += String_calcSizeBinary(&src->additionalInfo, NULL);
7517  if(src->hasInnerStatusCode)
7518  s += 4;
7519  if(src->hasInnerDiagnosticInfo)
7520  s += DiagnosticInfo_calcSizeBinary(src->innerDiagnosticInfo, NULL);
7521  return s;
7522 }
7523 
7524 const UA_calcSizeBinarySignature calcSizeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT + 1] = {
7525  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Boolean
7526  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Byte
7527  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize,
7528  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Int16
7529  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize,
7530  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Int32
7531  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize,
7532  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Int64
7533  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize,
7534  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Float
7535  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // Double
7536  (UA_calcSizeBinarySignature)String_calcSizeBinary,
7537  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // DateTime
7538  (UA_calcSizeBinarySignature)Guid_calcSizeBinary,
7539  (UA_calcSizeBinarySignature)String_calcSizeBinary, // ByteString
7540  (UA_calcSizeBinarySignature)String_calcSizeBinary, // XmlElement
7541  (UA_calcSizeBinarySignature)NodeId_calcSizeBinary,
7542  (UA_calcSizeBinarySignature)ExpandedNodeId_calcSizeBinary,
7543  (UA_calcSizeBinarySignature)calcSizeBinaryMemSize, // StatusCode
7545  (UA_calcSizeBinarySignature)LocalizedText_calcSizeBinary,
7546  (UA_calcSizeBinarySignature)ExtensionObject_calcSizeBinary,
7547  (UA_calcSizeBinarySignature)DataValue_calcSizeBinary,
7548  (UA_calcSizeBinarySignature)Variant_calcSizeBinary,
7549  (UA_calcSizeBinarySignature)DiagnosticInfo_calcSizeBinary,
7551 };
7552 
7553 size_t
7554 UA_calcSizeBinary(void *p, const UA_DataType *type) {
7555  size_t s = 0;
7556  uintptr_t ptr = (uintptr_t)p;
7557  u8 membersSize = type->membersSize;
7558  const UA_DataType *typelists[2] = { UA_TYPES, &type[-type->typeIndex] };
7559  for(size_t i = 0; i < membersSize; ++i) {
7560  const UA_DataTypeMember *member = &type->members[i];
7561  const UA_DataType *membertype = &typelists[!member->namespaceZero][member->memberTypeIndex];
7562  if(!member->isArray) {
7563  ptr += member->padding;
7564  size_t encode_index = membertype->builtin ? membertype->typeIndex : UA_BUILTIN_TYPES_COUNT;
7565  s += calcSizeBinaryJumpTable[encode_index]((const void*)ptr, membertype);
7566  ptr += membertype->memSize;
7567  } else {
7568  ptr += member->padding;
7569  const size_t length = *((const size_t*)ptr);
7570  ptr += sizeof(size_t);
7571  s += Array_calcSizeBinary(*(void *UA_RESTRICT const *)ptr, length, membertype);
7572  ptr += sizeof(void*);
7573  }
7574  }
7575  return s;
7576 }
7577 
7578 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_types_generated.c" ***********************************/
7579 
7580 /* Generated from Opc.Ua.Types.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
7581  * on host iosb-VirtualBox by user iosb at 2018-08-29 05:32:08 */
7582 
7583 
7584 /* Boolean */
7585 static UA_DataTypeMember Boolean_members[1] = {
7587 #ifdef UA_ENABLE_TYPENAMES
7588  .memberName = "",
7589 #endif
7590  .namespaceZero = true,
7591  .padding = 0,
7592  .isArray = false
7593  },};
7594 
7595 /* SByte */
7596 static UA_DataTypeMember SByte_members[1] = {
7598 #ifdef UA_ENABLE_TYPENAMES
7599  .memberName = "",
7600 #endif
7601  .namespaceZero = true,
7602  .padding = 0,
7603  .isArray = false
7604  },};
7605 
7606 /* Byte */
7607 static UA_DataTypeMember Byte_members[1] = {
7609 #ifdef UA_ENABLE_TYPENAMES
7610  .memberName = "",
7611 #endif
7612  .namespaceZero = true,
7613  .padding = 0,
7614  .isArray = false
7615  },};
7616 
7617 /* Int16 */
7618 static UA_DataTypeMember Int16_members[1] = {
7620 #ifdef UA_ENABLE_TYPENAMES
7621  .memberName = "",
7622 #endif
7623  .namespaceZero = true,
7624  .padding = 0,
7625  .isArray = false
7626  },};
7627 
7628 /* UInt16 */
7629 static UA_DataTypeMember UInt16_members[1] = {
7631 #ifdef UA_ENABLE_TYPENAMES
7632  .memberName = "",
7633 #endif
7634  .namespaceZero = true,
7635  .padding = 0,
7636  .isArray = false
7637  },};
7638 
7639 /* Int32 */
7640 static UA_DataTypeMember Int32_members[1] = {
7642 #ifdef UA_ENABLE_TYPENAMES
7643  .memberName = "",
7644 #endif
7645  .namespaceZero = true,
7646  .padding = 0,
7647  .isArray = false
7648  },};
7649 
7650 /* UInt32 */
7651 static UA_DataTypeMember UInt32_members[1] = {
7653 #ifdef UA_ENABLE_TYPENAMES
7654  .memberName = "",
7655 #endif
7656  .namespaceZero = true,
7657  .padding = 0,
7658  .isArray = false
7659  },};
7660 
7661 /* Int64 */
7662 static UA_DataTypeMember Int64_members[1] = {
7664 #ifdef UA_ENABLE_TYPENAMES
7665  .memberName = "",
7666 #endif
7667  .namespaceZero = true,
7668  .padding = 0,
7669  .isArray = false
7670  },};
7671 
7672 /* UInt64 */
7673 static UA_DataTypeMember UInt64_members[1] = {
7675 #ifdef UA_ENABLE_TYPENAMES
7676  .memberName = "",
7677 #endif
7678  .namespaceZero = true,
7679  .padding = 0,
7680  .isArray = false
7681  },};
7682 
7683 /* Float */
7684 static UA_DataTypeMember Float_members[1] = {
7686 #ifdef UA_ENABLE_TYPENAMES
7687  .memberName = "",
7688 #endif
7689  .namespaceZero = true,
7690  .padding = 0,
7691  .isArray = false
7692  },};
7693 
7694 /* Double */
7695 static UA_DataTypeMember Double_members[1] = {
7697 #ifdef UA_ENABLE_TYPENAMES
7698  .memberName = "",
7699 #endif
7700  .namespaceZero = true,
7701  .padding = 0,
7702  .isArray = false
7703  },};
7704 
7705 /* String */
7706 static UA_DataTypeMember String_members[1] = {
7708 #ifdef UA_ENABLE_TYPENAMES
7709  .memberName = "",
7710 #endif
7711  .namespaceZero = true,
7712  .padding = 0,
7713  .isArray = true
7714  },};
7715 
7716 /* DateTime */
7717 static UA_DataTypeMember DateTime_members[1] = {
7719 #ifdef UA_ENABLE_TYPENAMES
7720  .memberName = "",
7721 #endif
7722  .namespaceZero = true,
7723  .padding = 0,
7724  .isArray = false
7725  },};
7726 
7727 /* Guid */
7728 static UA_DataTypeMember Guid_members[1] = {
7730 #ifdef UA_ENABLE_TYPENAMES
7731  .memberName = "",
7732 #endif
7733  .namespaceZero = true,
7734  .padding = 0,
7735  .isArray = false
7736  },};
7737 
7738 /* ByteString */
7739 static UA_DataTypeMember ByteString_members[1] = {
7741 #ifdef UA_ENABLE_TYPENAMES
7742  .memberName = "",
7743 #endif
7744  .namespaceZero = true,
7745  .padding = 0,
7746  .isArray = true
7747  },};
7748 
7749 /* XmlElement */
7750 static UA_DataTypeMember XmlElement_members[1] = {
7752 #ifdef UA_ENABLE_TYPENAMES
7753  .memberName = "",
7754 #endif
7755  .namespaceZero = true,
7756  .padding = 0,
7757  .isArray = true
7758  },};
7759 
7760 /* NodeId */
7761 static UA_DataTypeMember NodeId_members[1] = {
7763 #ifdef UA_ENABLE_TYPENAMES
7764  .memberName = "",
7765 #endif
7766  .namespaceZero = true,
7767  .padding = 0,
7768  .isArray = false
7769  },};
7770 
7771 /* ExpandedNodeId */
7772 static UA_DataTypeMember ExpandedNodeId_members[1] = {
7774 #ifdef UA_ENABLE_TYPENAMES
7775  .memberName = "",
7776 #endif
7777  .namespaceZero = true,
7778  .padding = 0,
7779  .isArray = false
7780  },};
7781 
7782 /* StatusCode */
7783 static UA_DataTypeMember StatusCode_members[1] = {
7785 #ifdef UA_ENABLE_TYPENAMES
7786  .memberName = "",
7787 #endif
7788  .namespaceZero = true,
7789  .padding = 0,
7790  .isArray = false
7791  },};
7792 
7793 /* QualifiedName */
7794 static UA_DataTypeMember QualifiedName_members[2] = {
7796 #ifdef UA_ENABLE_TYPENAMES
7797  .memberName = "namespaceIndex",
7798 #endif
7799  .namespaceZero = true,
7800  .padding = 0,
7801  .isArray = false
7802  },
7803  { .memberTypeIndex = UA_TYPES_STRING,
7804 #ifdef UA_ENABLE_TYPENAMES
7805  .memberName = "name",
7806 #endif
7807  .namespaceZero = true,
7808  .padding = offsetof(UA_QualifiedName, name) - offsetof(UA_QualifiedName, namespaceIndex) - sizeof(UA_Int16),
7809  .isArray = false
7810  },};
7811 
7812 /* LocalizedText */
7813 static UA_DataTypeMember LocalizedText_members[1] = {
7815 #ifdef UA_ENABLE_TYPENAMES
7816  .memberName = "",
7817 #endif
7818  .namespaceZero = true,
7819  .padding = 0,
7820  .isArray = false
7821  },};
7822 
7823 /* ExtensionObject */
7824 static UA_DataTypeMember ExtensionObject_members[1] = {
7826 #ifdef UA_ENABLE_TYPENAMES
7827  .memberName = "",
7828 #endif
7829  .namespaceZero = true,
7830  .padding = 0,
7831  .isArray = false
7832  },};
7833 
7834 /* DataValue */
7835 static UA_DataTypeMember DataValue_members[1] = {
7837 #ifdef UA_ENABLE_TYPENAMES
7838  .memberName = "",
7839 #endif
7840  .namespaceZero = true,
7841  .padding = 0,
7842  .isArray = false
7843  },};
7844 
7845 /* Variant */
7846 static UA_DataTypeMember Variant_members[1] = {
7848 #ifdef UA_ENABLE_TYPENAMES
7849  .memberName = "",
7850 #endif
7851  .namespaceZero = true,
7852  .padding = 0,
7853  .isArray = false
7854  },};
7855 
7856 /* DiagnosticInfo */
7857 static UA_DataTypeMember DiagnosticInfo_members[1] = {
7859 #ifdef UA_ENABLE_TYPENAMES
7860  .memberName = "",
7861 #endif
7862  .namespaceZero = true,
7863  .padding = 0,
7864  .isArray = false
7865  },};
7866 
7867 /* SignedSoftwareCertificate */
7868 static UA_DataTypeMember SignedSoftwareCertificate_members[2] = {
7870 #ifdef UA_ENABLE_TYPENAMES
7871  .memberName = "certificateData",
7872 #endif
7873  .namespaceZero = true,
7874  .padding = 0,
7875  .isArray = false
7876  },
7877  { .memberTypeIndex = UA_TYPES_BYTESTRING,
7878 #ifdef UA_ENABLE_TYPENAMES
7879  .memberName = "signature",
7880 #endif
7881  .namespaceZero = true,
7882  .padding = offsetof(UA_SignedSoftwareCertificate, signature) - offsetof(UA_SignedSoftwareCertificate, certificateData) - sizeof(UA_ByteString),
7883  .isArray = false
7884  },};
7885 
7886 /* BrowsePathTarget */
7887 static UA_DataTypeMember BrowsePathTarget_members[2] = {
7889 #ifdef UA_ENABLE_TYPENAMES
7890  .memberName = "targetId",
7891 #endif
7892  .namespaceZero = true,
7893  .padding = 0,
7894  .isArray = false
7895  },
7896  { .memberTypeIndex = UA_TYPES_UINT32,
7897 #ifdef UA_ENABLE_TYPENAMES
7898  .memberName = "remainingPathIndex",
7899 #endif
7900  .namespaceZero = true,
7901  .padding = offsetof(UA_BrowsePathTarget, remainingPathIndex) - offsetof(UA_BrowsePathTarget, targetId) - sizeof(UA_ExpandedNodeId),
7902  .isArray = false
7903  },};
7904 
7905 /* ViewAttributes */
7906 static UA_DataTypeMember ViewAttributes_members[7] = {
7908 #ifdef UA_ENABLE_TYPENAMES
7909  .memberName = "specifiedAttributes",
7910 #endif
7911  .namespaceZero = true,
7912  .padding = 0,
7913  .isArray = false
7914  },
7915  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
7916 #ifdef UA_ENABLE_TYPENAMES
7917  .memberName = "displayName",
7918 #endif
7919  .namespaceZero = true,
7920  .padding = offsetof(UA_ViewAttributes, displayName) - offsetof(UA_ViewAttributes, specifiedAttributes) - sizeof(UA_UInt32),
7921  .isArray = false
7922  },
7923  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
7924 #ifdef UA_ENABLE_TYPENAMES
7925  .memberName = "description",
7926 #endif
7927  .namespaceZero = true,
7928  .padding = offsetof(UA_ViewAttributes, description) - offsetof(UA_ViewAttributes, displayName) - sizeof(UA_LocalizedText),
7929  .isArray = false
7930  },
7931  { .memberTypeIndex = UA_TYPES_UINT32,
7932 #ifdef UA_ENABLE_TYPENAMES
7933  .memberName = "writeMask",
7934 #endif
7935  .namespaceZero = true,
7936  .padding = offsetof(UA_ViewAttributes, writeMask) - offsetof(UA_ViewAttributes, description) - sizeof(UA_LocalizedText),
7937  .isArray = false
7938  },
7939  { .memberTypeIndex = UA_TYPES_UINT32,
7940 #ifdef UA_ENABLE_TYPENAMES
7941  .memberName = "userWriteMask",
7942 #endif
7943  .namespaceZero = true,
7944  .padding = offsetof(UA_ViewAttributes, userWriteMask) - offsetof(UA_ViewAttributes, writeMask) - sizeof(UA_UInt32),
7945  .isArray = false
7946  },
7947  { .memberTypeIndex = UA_TYPES_BOOLEAN,
7948 #ifdef UA_ENABLE_TYPENAMES
7949  .memberName = "containsNoLoops",
7950 #endif
7951  .namespaceZero = true,
7952  .padding = offsetof(UA_ViewAttributes, containsNoLoops) - offsetof(UA_ViewAttributes, userWriteMask) - sizeof(UA_UInt32),
7953  .isArray = false
7954  },
7955  { .memberTypeIndex = UA_TYPES_BYTE,
7956 #ifdef UA_ENABLE_TYPENAMES
7957  .memberName = "eventNotifier",
7958 #endif
7959  .namespaceZero = true,
7960  .padding = offsetof(UA_ViewAttributes, eventNotifier) - offsetof(UA_ViewAttributes, containsNoLoops) - sizeof(UA_Boolean),
7961  .isArray = false
7962  },};
7963 
7964 /* BrowseResultMask */
7965 static UA_DataTypeMember BrowseResultMask_members[1] = {
7967 #ifdef UA_ENABLE_TYPENAMES
7968  .memberName = "",
7969 #endif
7970  .namespaceZero = true,
7971  .padding = 0,
7972  .isArray = false
7973  },};
7974 
7975 /* RequestHeader */
7976 static UA_DataTypeMember RequestHeader_members[7] = {
7978 #ifdef UA_ENABLE_TYPENAMES
7979  .memberName = "authenticationToken",
7980 #endif
7981  .namespaceZero = true,
7982  .padding = 0,
7983  .isArray = false
7984  },
7985  { .memberTypeIndex = UA_TYPES_DATETIME,
7986 #ifdef UA_ENABLE_TYPENAMES
7987  .memberName = "timestamp",
7988 #endif
7989  .namespaceZero = true,
7990  .padding = offsetof(UA_RequestHeader, timestamp) - offsetof(UA_RequestHeader, authenticationToken) - sizeof(UA_NodeId),
7991  .isArray = false
7992  },
7993  { .memberTypeIndex = UA_TYPES_UINT32,
7994 #ifdef UA_ENABLE_TYPENAMES
7995  .memberName = "requestHandle",
7996 #endif
7997  .namespaceZero = true,
7998  .padding = offsetof(UA_RequestHeader, requestHandle) - offsetof(UA_RequestHeader, timestamp) - sizeof(UA_DateTime),
7999  .isArray = false
8000  },
8001  { .memberTypeIndex = UA_TYPES_UINT32,
8002 #ifdef UA_ENABLE_TYPENAMES
8003  .memberName = "returnDiagnostics",
8004 #endif
8005  .namespaceZero = true,
8006  .padding = offsetof(UA_RequestHeader, returnDiagnostics) - offsetof(UA_RequestHeader, requestHandle) - sizeof(UA_UInt32),
8007  .isArray = false
8008  },
8009  { .memberTypeIndex = UA_TYPES_STRING,
8010 #ifdef UA_ENABLE_TYPENAMES
8011  .memberName = "auditEntryId",
8012 #endif
8013  .namespaceZero = true,
8014  .padding = offsetof(UA_RequestHeader, auditEntryId) - offsetof(UA_RequestHeader, returnDiagnostics) - sizeof(UA_UInt32),
8015  .isArray = false
8016  },
8017  { .memberTypeIndex = UA_TYPES_UINT32,
8018 #ifdef UA_ENABLE_TYPENAMES
8019  .memberName = "timeoutHint",
8020 #endif
8021  .namespaceZero = true,
8022  .padding = offsetof(UA_RequestHeader, timeoutHint) - offsetof(UA_RequestHeader, auditEntryId) - sizeof(UA_String),
8023  .isArray = false
8024  },
8025  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
8026 #ifdef UA_ENABLE_TYPENAMES
8027  .memberName = "additionalHeader",
8028 #endif
8029  .namespaceZero = true,
8030  .padding = offsetof(UA_RequestHeader, additionalHeader) - offsetof(UA_RequestHeader, timeoutHint) - sizeof(UA_UInt32),
8031  .isArray = false
8032  },};
8033 
8034 /* MonitoredItemModifyResult */
8035 static UA_DataTypeMember MonitoredItemModifyResult_members[4] = {
8037 #ifdef UA_ENABLE_TYPENAMES
8038  .memberName = "statusCode",
8039 #endif
8040  .namespaceZero = true,
8041  .padding = 0,
8042  .isArray = false
8043  },
8044  { .memberTypeIndex = UA_TYPES_DOUBLE,
8045 #ifdef UA_ENABLE_TYPENAMES
8046  .memberName = "revisedSamplingInterval",
8047 #endif
8048  .namespaceZero = true,
8049  .padding = offsetof(UA_MonitoredItemModifyResult, revisedSamplingInterval) - offsetof(UA_MonitoredItemModifyResult, statusCode) - sizeof(UA_StatusCode),
8050  .isArray = false
8051  },
8052  { .memberTypeIndex = UA_TYPES_UINT32,
8053 #ifdef UA_ENABLE_TYPENAMES
8054  .memberName = "revisedQueueSize",
8055 #endif
8056  .namespaceZero = true,
8057  .padding = offsetof(UA_MonitoredItemModifyResult, revisedQueueSize) - offsetof(UA_MonitoredItemModifyResult, revisedSamplingInterval) - sizeof(UA_Double),
8058  .isArray = false
8059  },
8060  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
8061 #ifdef UA_ENABLE_TYPENAMES
8062  .memberName = "filterResult",
8063 #endif
8064  .namespaceZero = true,
8065  .padding = offsetof(UA_MonitoredItemModifyResult, filterResult) - offsetof(UA_MonitoredItemModifyResult, revisedQueueSize) - sizeof(UA_UInt32),
8066  .isArray = false
8067  },};
8068 
8069 /* CloseSecureChannelRequest */
8070 static UA_DataTypeMember CloseSecureChannelRequest_members[1] = {
8072 #ifdef UA_ENABLE_TYPENAMES
8073  .memberName = "requestHeader",
8074 #endif
8075  .namespaceZero = true,
8076  .padding = 0,
8077  .isArray = false
8078  },};
8079 
8080 /* AddNodesResult */
8081 static UA_DataTypeMember AddNodesResult_members[2] = {
8083 #ifdef UA_ENABLE_TYPENAMES
8084  .memberName = "statusCode",
8085 #endif
8086  .namespaceZero = true,
8087  .padding = 0,
8088  .isArray = false
8089  },
8090  { .memberTypeIndex = UA_TYPES_NODEID,
8091 #ifdef UA_ENABLE_TYPENAMES
8092  .memberName = "addedNodeId",
8093 #endif
8094  .namespaceZero = true,
8095  .padding = offsetof(UA_AddNodesResult, addedNodeId) - offsetof(UA_AddNodesResult, statusCode) - sizeof(UA_StatusCode),
8096  .isArray = false
8097  },};
8098 
8099 /* VariableAttributes */
8100 static UA_DataTypeMember VariableAttributes_members[13] = {
8102 #ifdef UA_ENABLE_TYPENAMES
8103  .memberName = "specifiedAttributes",
8104 #endif
8105  .namespaceZero = true,
8106  .padding = 0,
8107  .isArray = false
8108  },
8109  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8110 #ifdef UA_ENABLE_TYPENAMES
8111  .memberName = "displayName",
8112 #endif
8113  .namespaceZero = true,
8114  .padding = offsetof(UA_VariableAttributes, displayName) - offsetof(UA_VariableAttributes, specifiedAttributes) - sizeof(UA_UInt32),
8115  .isArray = false
8116  },
8117  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8118 #ifdef UA_ENABLE_TYPENAMES
8119  .memberName = "description",
8120 #endif
8121  .namespaceZero = true,
8122  .padding = offsetof(UA_VariableAttributes, description) - offsetof(UA_VariableAttributes, displayName) - sizeof(UA_LocalizedText),
8123  .isArray = false
8124  },
8125  { .memberTypeIndex = UA_TYPES_UINT32,
8126 #ifdef UA_ENABLE_TYPENAMES
8127  .memberName = "writeMask",
8128 #endif
8129  .namespaceZero = true,
8130  .padding = offsetof(UA_VariableAttributes, writeMask) - offsetof(UA_VariableAttributes, description) - sizeof(UA_LocalizedText),
8131  .isArray = false
8132  },
8133  { .memberTypeIndex = UA_TYPES_UINT32,
8134 #ifdef UA_ENABLE_TYPENAMES
8135  .memberName = "userWriteMask",
8136 #endif
8137  .namespaceZero = true,
8138  .padding = offsetof(UA_VariableAttributes, userWriteMask) - offsetof(UA_VariableAttributes, writeMask) - sizeof(UA_UInt32),
8139  .isArray = false
8140  },
8141  { .memberTypeIndex = UA_TYPES_VARIANT,
8142 #ifdef UA_ENABLE_TYPENAMES
8143  .memberName = "value",
8144 #endif
8145  .namespaceZero = true,
8146  .padding = offsetof(UA_VariableAttributes, value) - offsetof(UA_VariableAttributes, userWriteMask) - sizeof(UA_UInt32),
8147  .isArray = false
8148  },
8149  { .memberTypeIndex = UA_TYPES_NODEID,
8150 #ifdef UA_ENABLE_TYPENAMES
8151  .memberName = "dataType",
8152 #endif
8153  .namespaceZero = true,
8154  .padding = offsetof(UA_VariableAttributes, dataType) - offsetof(UA_VariableAttributes, value) - sizeof(UA_Variant),
8155  .isArray = false
8156  },
8157  { .memberTypeIndex = UA_TYPES_INT32,
8158 #ifdef UA_ENABLE_TYPENAMES
8159  .memberName = "valueRank",
8160 #endif
8161  .namespaceZero = true,
8162  .padding = offsetof(UA_VariableAttributes, valueRank) - offsetof(UA_VariableAttributes, dataType) - sizeof(UA_NodeId),
8163  .isArray = false
8164  },
8165  { .memberTypeIndex = UA_TYPES_UINT32,
8166 #ifdef UA_ENABLE_TYPENAMES
8167  .memberName = "arrayDimensions",
8168 #endif
8169  .namespaceZero = true,
8170  .padding = offsetof(UA_VariableAttributes, arrayDimensionsSize) - offsetof(UA_VariableAttributes, valueRank) - sizeof(UA_Int32),
8171  .isArray = true
8172  },
8173  { .memberTypeIndex = UA_TYPES_BYTE,
8174 #ifdef UA_ENABLE_TYPENAMES
8175  .memberName = "accessLevel",
8176 #endif
8177  .namespaceZero = true,
8178  .padding = offsetof(UA_VariableAttributes, accessLevel) - offsetof(UA_VariableAttributes, arrayDimensions) - sizeof(void*),
8179  .isArray = false
8180  },
8181  { .memberTypeIndex = UA_TYPES_BYTE,
8182 #ifdef UA_ENABLE_TYPENAMES
8183  .memberName = "userAccessLevel",
8184 #endif
8185  .namespaceZero = true,
8186  .padding = offsetof(UA_VariableAttributes, userAccessLevel) - offsetof(UA_VariableAttributes, accessLevel) - sizeof(UA_Byte),
8187  .isArray = false
8188  },
8189  { .memberTypeIndex = UA_TYPES_DOUBLE,
8190 #ifdef UA_ENABLE_TYPENAMES
8191  .memberName = "minimumSamplingInterval",
8192 #endif
8193  .namespaceZero = true,
8194  .padding = offsetof(UA_VariableAttributes, minimumSamplingInterval) - offsetof(UA_VariableAttributes, userAccessLevel) - sizeof(UA_Byte),
8195  .isArray = false
8196  },
8197  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8198 #ifdef UA_ENABLE_TYPENAMES
8199  .memberName = "historizing",
8200 #endif
8201  .namespaceZero = true,
8202  .padding = offsetof(UA_VariableAttributes, historizing) - offsetof(UA_VariableAttributes, minimumSamplingInterval) - sizeof(UA_Double),
8203  .isArray = false
8204  },};
8205 
8206 /* NotificationMessage */
8207 static UA_DataTypeMember NotificationMessage_members[3] = {
8209 #ifdef UA_ENABLE_TYPENAMES
8210  .memberName = "sequenceNumber",
8211 #endif
8212  .namespaceZero = true,
8213  .padding = 0,
8214  .isArray = false
8215  },
8216  { .memberTypeIndex = UA_TYPES_DATETIME,
8217 #ifdef UA_ENABLE_TYPENAMES
8218  .memberName = "publishTime",
8219 #endif
8220  .namespaceZero = true,
8221  .padding = offsetof(UA_NotificationMessage, publishTime) - offsetof(UA_NotificationMessage, sequenceNumber) - sizeof(UA_UInt32),
8222  .isArray = false
8223  },
8224  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
8225 #ifdef UA_ENABLE_TYPENAMES
8226  .memberName = "notificationData",
8227 #endif
8228  .namespaceZero = true,
8229  .padding = offsetof(UA_NotificationMessage, notificationDataSize) - offsetof(UA_NotificationMessage, publishTime) - sizeof(UA_DateTime),
8230  .isArray = true
8231  },};
8232 
8233 /* NodeAttributesMask */
8234 static UA_DataTypeMember NodeAttributesMask_members[1] = {
8236 #ifdef UA_ENABLE_TYPENAMES
8237  .memberName = "",
8238 #endif
8239  .namespaceZero = true,
8240  .padding = 0,
8241  .isArray = false
8242  },};
8243 
8244 /* MonitoringMode */
8245 static UA_DataTypeMember MonitoringMode_members[1] = {
8247 #ifdef UA_ENABLE_TYPENAMES
8248  .memberName = "",
8249 #endif
8250  .namespaceZero = true,
8251  .padding = 0,
8252  .isArray = false
8253  },};
8254 
8255 /* CallMethodResult */
8256 static UA_DataTypeMember CallMethodResult_members[4] = {
8258 #ifdef UA_ENABLE_TYPENAMES
8259  .memberName = "statusCode",
8260 #endif
8261  .namespaceZero = true,
8262  .padding = 0,
8263  .isArray = false
8264  },
8265  { .memberTypeIndex = UA_TYPES_STATUSCODE,
8266 #ifdef UA_ENABLE_TYPENAMES
8267  .memberName = "inputArgumentResults",
8268 #endif
8269  .namespaceZero = true,
8270  .padding = offsetof(UA_CallMethodResult, inputArgumentResultsSize) - offsetof(UA_CallMethodResult, statusCode) - sizeof(UA_StatusCode),
8271  .isArray = true
8272  },
8273  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
8274 #ifdef UA_ENABLE_TYPENAMES
8275  .memberName = "inputArgumentDiagnosticInfos",
8276 #endif
8277  .namespaceZero = true,
8278  .padding = offsetof(UA_CallMethodResult, inputArgumentDiagnosticInfosSize) - offsetof(UA_CallMethodResult, inputArgumentResults) - sizeof(void*),
8279  .isArray = true
8280  },
8281  { .memberTypeIndex = UA_TYPES_VARIANT,
8282 #ifdef UA_ENABLE_TYPENAMES
8283  .memberName = "outputArguments",
8284 #endif
8285  .namespaceZero = true,
8286  .padding = offsetof(UA_CallMethodResult, outputArgumentsSize) - offsetof(UA_CallMethodResult, inputArgumentDiagnosticInfos) - sizeof(void*),
8287  .isArray = true
8288  },};
8289 
8290 /* ParsingResult */
8291 static UA_DataTypeMember ParsingResult_members[3] = {
8293 #ifdef UA_ENABLE_TYPENAMES
8294  .memberName = "statusCode",
8295 #endif
8296  .namespaceZero = true,
8297  .padding = 0,
8298  .isArray = false
8299  },
8300  { .memberTypeIndex = UA_TYPES_STATUSCODE,
8301 #ifdef UA_ENABLE_TYPENAMES
8302  .memberName = "dataStatusCodes",
8303 #endif
8304  .namespaceZero = true,
8305  .padding = offsetof(UA_ParsingResult, dataStatusCodesSize) - offsetof(UA_ParsingResult, statusCode) - sizeof(UA_StatusCode),
8306  .isArray = true
8307  },
8308  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
8309 #ifdef UA_ENABLE_TYPENAMES
8310  .memberName = "dataDiagnosticInfos",
8311 #endif
8312  .namespaceZero = true,
8313  .padding = offsetof(UA_ParsingResult, dataDiagnosticInfosSize) - offsetof(UA_ParsingResult, dataStatusCodes) - sizeof(void*),
8314  .isArray = true
8315  },};
8316 
8317 /* RelativePathElement */
8318 static UA_DataTypeMember RelativePathElement_members[4] = {
8320 #ifdef UA_ENABLE_TYPENAMES
8321  .memberName = "referenceTypeId",
8322 #endif
8323  .namespaceZero = true,
8324  .padding = 0,
8325  .isArray = false
8326  },
8327  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8328 #ifdef UA_ENABLE_TYPENAMES
8329  .memberName = "isInverse",
8330 #endif
8331  .namespaceZero = true,
8332  .padding = offsetof(UA_RelativePathElement, isInverse) - offsetof(UA_RelativePathElement, referenceTypeId) - sizeof(UA_NodeId),
8333  .isArray = false
8334  },
8335  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8336 #ifdef UA_ENABLE_TYPENAMES
8337  .memberName = "includeSubtypes",
8338 #endif
8339  .namespaceZero = true,
8340  .padding = offsetof(UA_RelativePathElement, includeSubtypes) - offsetof(UA_RelativePathElement, isInverse) - sizeof(UA_Boolean),
8341  .isArray = false
8342  },
8343  { .memberTypeIndex = UA_TYPES_QUALIFIEDNAME,
8344 #ifdef UA_ENABLE_TYPENAMES
8345  .memberName = "targetName",
8346 #endif
8347  .namespaceZero = true,
8348  .padding = offsetof(UA_RelativePathElement, targetName) - offsetof(UA_RelativePathElement, includeSubtypes) - sizeof(UA_Boolean),
8349  .isArray = false
8350  },};
8351 
8352 /* BrowseDirection */
8353 static UA_DataTypeMember BrowseDirection_members[1] = {
8355 #ifdef UA_ENABLE_TYPENAMES
8356  .memberName = "",
8357 #endif
8358  .namespaceZero = true,
8359  .padding = 0,
8360  .isArray = false
8361  },};
8362 
8363 /* CallMethodRequest */
8364 static UA_DataTypeMember CallMethodRequest_members[3] = {
8366 #ifdef UA_ENABLE_TYPENAMES
8367  .memberName = "objectId",
8368 #endif
8369  .namespaceZero = true,
8370  .padding = 0,
8371  .isArray = false
8372  },
8373  { .memberTypeIndex = UA_TYPES_NODEID,
8374 #ifdef UA_ENABLE_TYPENAMES
8375  .memberName = "methodId",
8376 #endif
8377  .namespaceZero = true,
8378  .padding = offsetof(UA_CallMethodRequest, methodId) - offsetof(UA_CallMethodRequest, objectId) - sizeof(UA_NodeId),
8379  .isArray = false
8380  },
8381  { .memberTypeIndex = UA_TYPES_VARIANT,
8382 #ifdef UA_ENABLE_TYPENAMES
8383  .memberName = "inputArguments",
8384 #endif
8385  .namespaceZero = true,
8386  .padding = offsetof(UA_CallMethodRequest, inputArgumentsSize) - offsetof(UA_CallMethodRequest, methodId) - sizeof(UA_NodeId),
8387  .isArray = true
8388  },};
8389 
8390 /* UnregisterNodesRequest */
8391 static UA_DataTypeMember UnregisterNodesRequest_members[2] = {
8393 #ifdef UA_ENABLE_TYPENAMES
8394  .memberName = "requestHeader",
8395 #endif
8396  .namespaceZero = true,
8397  .padding = 0,
8398  .isArray = false
8399  },
8400  { .memberTypeIndex = UA_TYPES_NODEID,
8401 #ifdef UA_ENABLE_TYPENAMES
8402  .memberName = "nodesToUnregister",
8403 #endif
8404  .namespaceZero = true,
8405  .padding = offsetof(UA_UnregisterNodesRequest, nodesToUnregisterSize) - offsetof(UA_UnregisterNodesRequest, requestHeader) - sizeof(UA_RequestHeader),
8406  .isArray = true
8407  },};
8408 
8409 /* ContentFilterElementResult */
8410 static UA_DataTypeMember ContentFilterElementResult_members[3] = {
8412 #ifdef UA_ENABLE_TYPENAMES
8413  .memberName = "statusCode",
8414 #endif
8415  .namespaceZero = true,
8416  .padding = 0,
8417  .isArray = false
8418  },
8419  { .memberTypeIndex = UA_TYPES_STATUSCODE,
8420 #ifdef UA_ENABLE_TYPENAMES
8421  .memberName = "operandStatusCodes",
8422 #endif
8423  .namespaceZero = true,
8424  .padding = offsetof(UA_ContentFilterElementResult, operandStatusCodesSize) - offsetof(UA_ContentFilterElementResult, statusCode) - sizeof(UA_StatusCode),
8425  .isArray = true
8426  },
8427  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
8428 #ifdef UA_ENABLE_TYPENAMES
8429  .memberName = "operandDiagnosticInfos",
8430 #endif
8431  .namespaceZero = true,
8432  .padding = offsetof(UA_ContentFilterElementResult, operandDiagnosticInfosSize) - offsetof(UA_ContentFilterElementResult, operandStatusCodes) - sizeof(void*),
8433  .isArray = true
8434  },};
8435 
8436 /* QueryDataSet */
8437 static UA_DataTypeMember QueryDataSet_members[3] = {
8439 #ifdef UA_ENABLE_TYPENAMES
8440  .memberName = "nodeId",
8441 #endif
8442  .namespaceZero = true,
8443  .padding = 0,
8444  .isArray = false
8445  },
8446  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
8447 #ifdef UA_ENABLE_TYPENAMES
8448  .memberName = "typeDefinitionNode",
8449 #endif
8450  .namespaceZero = true,
8451  .padding = offsetof(UA_QueryDataSet, typeDefinitionNode) - offsetof(UA_QueryDataSet, nodeId) - sizeof(UA_ExpandedNodeId),
8452  .isArray = false
8453  },
8454  { .memberTypeIndex = UA_TYPES_VARIANT,
8455 #ifdef UA_ENABLE_TYPENAMES
8456  .memberName = "values",
8457 #endif
8458  .namespaceZero = true,
8459  .padding = offsetof(UA_QueryDataSet, valuesSize) - offsetof(UA_QueryDataSet, typeDefinitionNode) - sizeof(UA_ExpandedNodeId),
8460  .isArray = true
8461  },};
8462 
8463 /* AnonymousIdentityToken */
8464 static UA_DataTypeMember AnonymousIdentityToken_members[1] = {
8466 #ifdef UA_ENABLE_TYPENAMES
8467  .memberName = "policyId",
8468 #endif
8469  .namespaceZero = true,
8470  .padding = 0,
8471  .isArray = false
8472  },};
8473 
8474 /* SetPublishingModeRequest */
8475 static UA_DataTypeMember SetPublishingModeRequest_members[3] = {
8477 #ifdef UA_ENABLE_TYPENAMES
8478  .memberName = "requestHeader",
8479 #endif
8480  .namespaceZero = true,
8481  .padding = 0,
8482  .isArray = false
8483  },
8484  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8485 #ifdef UA_ENABLE_TYPENAMES
8486  .memberName = "publishingEnabled",
8487 #endif
8488  .namespaceZero = true,
8489  .padding = offsetof(UA_SetPublishingModeRequest, publishingEnabled) - offsetof(UA_SetPublishingModeRequest, requestHeader) - sizeof(UA_RequestHeader),
8490  .isArray = false
8491  },
8492  { .memberTypeIndex = UA_TYPES_UINT32,
8493 #ifdef UA_ENABLE_TYPENAMES
8494  .memberName = "subscriptionIds",
8495 #endif
8496  .namespaceZero = true,
8497  .padding = offsetof(UA_SetPublishingModeRequest, subscriptionIdsSize) - offsetof(UA_SetPublishingModeRequest, publishingEnabled) - sizeof(UA_Boolean),
8498  .isArray = true
8499  },};
8500 
8501 /* TimestampsToReturn */
8502 static UA_DataTypeMember TimestampsToReturn_members[1] = {
8504 #ifdef UA_ENABLE_TYPENAMES
8505  .memberName = "",
8506 #endif
8507  .namespaceZero = true,
8508  .padding = 0,
8509  .isArray = false
8510  },};
8511 
8512 /* CallRequest */
8513 static UA_DataTypeMember CallRequest_members[2] = {
8515 #ifdef UA_ENABLE_TYPENAMES
8516  .memberName = "requestHeader",
8517 #endif
8518  .namespaceZero = true,
8519  .padding = 0,
8520  .isArray = false
8521  },
8522  { .memberTypeIndex = UA_TYPES_CALLMETHODREQUEST,
8523 #ifdef UA_ENABLE_TYPENAMES
8524  .memberName = "methodsToCall",
8525 #endif
8526  .namespaceZero = true,
8527  .padding = offsetof(UA_CallRequest, methodsToCallSize) - offsetof(UA_CallRequest, requestHeader) - sizeof(UA_RequestHeader),
8528  .isArray = true
8529  },};
8530 
8531 /* MethodAttributes */
8532 static UA_DataTypeMember MethodAttributes_members[7] = {
8534 #ifdef UA_ENABLE_TYPENAMES
8535  .memberName = "specifiedAttributes",
8536 #endif
8537  .namespaceZero = true,
8538  .padding = 0,
8539  .isArray = false
8540  },
8541  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8542 #ifdef UA_ENABLE_TYPENAMES
8543  .memberName = "displayName",
8544 #endif
8545  .namespaceZero = true,
8546  .padding = offsetof(UA_MethodAttributes, displayName) - offsetof(UA_MethodAttributes, specifiedAttributes) - sizeof(UA_UInt32),
8547  .isArray = false
8548  },
8549  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8550 #ifdef UA_ENABLE_TYPENAMES
8551  .memberName = "description",
8552 #endif
8553  .namespaceZero = true,
8554  .padding = offsetof(UA_MethodAttributes, description) - offsetof(UA_MethodAttributes, displayName) - sizeof(UA_LocalizedText),
8555  .isArray = false
8556  },
8557  { .memberTypeIndex = UA_TYPES_UINT32,
8558 #ifdef UA_ENABLE_TYPENAMES
8559  .memberName = "writeMask",
8560 #endif
8561  .namespaceZero = true,
8562  .padding = offsetof(UA_MethodAttributes, writeMask) - offsetof(UA_MethodAttributes, description) - sizeof(UA_LocalizedText),
8563  .isArray = false
8564  },
8565  { .memberTypeIndex = UA_TYPES_UINT32,
8566 #ifdef UA_ENABLE_TYPENAMES
8567  .memberName = "userWriteMask",
8568 #endif
8569  .namespaceZero = true,
8570  .padding = offsetof(UA_MethodAttributes, userWriteMask) - offsetof(UA_MethodAttributes, writeMask) - sizeof(UA_UInt32),
8571  .isArray = false
8572  },
8573  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8574 #ifdef UA_ENABLE_TYPENAMES
8575  .memberName = "executable",
8576 #endif
8577  .namespaceZero = true,
8578  .padding = offsetof(UA_MethodAttributes, executable) - offsetof(UA_MethodAttributes, userWriteMask) - sizeof(UA_UInt32),
8579  .isArray = false
8580  },
8581  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8582 #ifdef UA_ENABLE_TYPENAMES
8583  .memberName = "userExecutable",
8584 #endif
8585  .namespaceZero = true,
8586  .padding = offsetof(UA_MethodAttributes, userExecutable) - offsetof(UA_MethodAttributes, executable) - sizeof(UA_Boolean),
8587  .isArray = false
8588  },};
8589 
8590 /* DeleteReferencesItem */
8591 static UA_DataTypeMember DeleteReferencesItem_members[5] = {
8593 #ifdef UA_ENABLE_TYPENAMES
8594  .memberName = "sourceNodeId",
8595 #endif
8596  .namespaceZero = true,
8597  .padding = 0,
8598  .isArray = false
8599  },
8600  { .memberTypeIndex = UA_TYPES_NODEID,
8601 #ifdef UA_ENABLE_TYPENAMES
8602  .memberName = "referenceTypeId",
8603 #endif
8604  .namespaceZero = true,
8605  .padding = offsetof(UA_DeleteReferencesItem, referenceTypeId) - offsetof(UA_DeleteReferencesItem, sourceNodeId) - sizeof(UA_NodeId),
8606  .isArray = false
8607  },
8608  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8609 #ifdef UA_ENABLE_TYPENAMES
8610  .memberName = "isForward",
8611 #endif
8612  .namespaceZero = true,
8613  .padding = offsetof(UA_DeleteReferencesItem, isForward) - offsetof(UA_DeleteReferencesItem, referenceTypeId) - sizeof(UA_NodeId),
8614  .isArray = false
8615  },
8616  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
8617 #ifdef UA_ENABLE_TYPENAMES
8618  .memberName = "targetNodeId",
8619 #endif
8620  .namespaceZero = true,
8621  .padding = offsetof(UA_DeleteReferencesItem, targetNodeId) - offsetof(UA_DeleteReferencesItem, isForward) - sizeof(UA_Boolean),
8622  .isArray = false
8623  },
8624  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8625 #ifdef UA_ENABLE_TYPENAMES
8626  .memberName = "deleteBidirectional",
8627 #endif
8628  .namespaceZero = true,
8629  .padding = offsetof(UA_DeleteReferencesItem, deleteBidirectional) - offsetof(UA_DeleteReferencesItem, targetNodeId) - sizeof(UA_ExpandedNodeId),
8630  .isArray = false
8631  },};
8632 
8633 /* WriteValue */
8634 static UA_DataTypeMember WriteValue_members[4] = {
8636 #ifdef UA_ENABLE_TYPENAMES
8637  .memberName = "nodeId",
8638 #endif
8639  .namespaceZero = true,
8640  .padding = 0,
8641  .isArray = false
8642  },
8643  { .memberTypeIndex = UA_TYPES_UINT32,
8644 #ifdef UA_ENABLE_TYPENAMES
8645  .memberName = "attributeId",
8646 #endif
8647  .namespaceZero = true,
8648  .padding = offsetof(UA_WriteValue, attributeId) - offsetof(UA_WriteValue, nodeId) - sizeof(UA_NodeId),
8649  .isArray = false
8650  },
8651  { .memberTypeIndex = UA_TYPES_STRING,
8652 #ifdef UA_ENABLE_TYPENAMES
8653  .memberName = "indexRange",
8654 #endif
8655  .namespaceZero = true,
8656  .padding = offsetof(UA_WriteValue, indexRange) - offsetof(UA_WriteValue, attributeId) - sizeof(UA_UInt32),
8657  .isArray = false
8658  },
8659  { .memberTypeIndex = UA_TYPES_DATAVALUE,
8660 #ifdef UA_ENABLE_TYPENAMES
8661  .memberName = "value",
8662 #endif
8663  .namespaceZero = true,
8664  .padding = offsetof(UA_WriteValue, value) - offsetof(UA_WriteValue, indexRange) - sizeof(UA_String),
8665  .isArray = false
8666  },};
8667 
8668 /* MonitoredItemCreateResult */
8669 static UA_DataTypeMember MonitoredItemCreateResult_members[5] = {
8671 #ifdef UA_ENABLE_TYPENAMES
8672  .memberName = "statusCode",
8673 #endif
8674  .namespaceZero = true,
8675  .padding = 0,
8676  .isArray = false
8677  },
8678  { .memberTypeIndex = UA_TYPES_UINT32,
8679 #ifdef UA_ENABLE_TYPENAMES
8680  .memberName = "monitoredItemId",
8681 #endif
8682  .namespaceZero = true,
8683  .padding = offsetof(UA_MonitoredItemCreateResult, monitoredItemId) - offsetof(UA_MonitoredItemCreateResult, statusCode) - sizeof(UA_StatusCode),
8684  .isArray = false
8685  },
8686  { .memberTypeIndex = UA_TYPES_DOUBLE,
8687 #ifdef UA_ENABLE_TYPENAMES
8688  .memberName = "revisedSamplingInterval",
8689 #endif
8690  .namespaceZero = true,
8691  .padding = offsetof(UA_MonitoredItemCreateResult, revisedSamplingInterval) - offsetof(UA_MonitoredItemCreateResult, monitoredItemId) - sizeof(UA_UInt32),
8692  .isArray = false
8693  },
8694  { .memberTypeIndex = UA_TYPES_UINT32,
8695 #ifdef UA_ENABLE_TYPENAMES
8696  .memberName = "revisedQueueSize",
8697 #endif
8698  .namespaceZero = true,
8699  .padding = offsetof(UA_MonitoredItemCreateResult, revisedQueueSize) - offsetof(UA_MonitoredItemCreateResult, revisedSamplingInterval) - sizeof(UA_Double),
8700  .isArray = false
8701  },
8702  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
8703 #ifdef UA_ENABLE_TYPENAMES
8704  .memberName = "filterResult",
8705 #endif
8706  .namespaceZero = true,
8707  .padding = offsetof(UA_MonitoredItemCreateResult, filterResult) - offsetof(UA_MonitoredItemCreateResult, revisedQueueSize) - sizeof(UA_UInt32),
8708  .isArray = false
8709  },};
8710 
8711 /* MessageSecurityMode */
8712 static UA_DataTypeMember MessageSecurityMode_members[1] = {
8714 #ifdef UA_ENABLE_TYPENAMES
8715  .memberName = "",
8716 #endif
8717  .namespaceZero = true,
8718  .padding = 0,
8719  .isArray = false
8720  },};
8721 
8722 /* MonitoringParameters */
8723 static UA_DataTypeMember MonitoringParameters_members[5] = {
8725 #ifdef UA_ENABLE_TYPENAMES
8726  .memberName = "clientHandle",
8727 #endif
8728  .namespaceZero = true,
8729  .padding = 0,
8730  .isArray = false
8731  },
8732  { .memberTypeIndex = UA_TYPES_DOUBLE,
8733 #ifdef UA_ENABLE_TYPENAMES
8734  .memberName = "samplingInterval",
8735 #endif
8736  .namespaceZero = true,
8737  .padding = offsetof(UA_MonitoringParameters, samplingInterval) - offsetof(UA_MonitoringParameters, clientHandle) - sizeof(UA_UInt32),
8738  .isArray = false
8739  },
8740  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
8741 #ifdef UA_ENABLE_TYPENAMES
8742  .memberName = "filter",
8743 #endif
8744  .namespaceZero = true,
8745  .padding = offsetof(UA_MonitoringParameters, filter) - offsetof(UA_MonitoringParameters, samplingInterval) - sizeof(UA_Double),
8746  .isArray = false
8747  },
8748  { .memberTypeIndex = UA_TYPES_UINT32,
8749 #ifdef UA_ENABLE_TYPENAMES
8750  .memberName = "queueSize",
8751 #endif
8752  .namespaceZero = true,
8753  .padding = offsetof(UA_MonitoringParameters, queueSize) - offsetof(UA_MonitoringParameters, filter) - sizeof(UA_ExtensionObject),
8754  .isArray = false
8755  },
8756  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8757 #ifdef UA_ENABLE_TYPENAMES
8758  .memberName = "discardOldest",
8759 #endif
8760  .namespaceZero = true,
8761  .padding = offsetof(UA_MonitoringParameters, discardOldest) - offsetof(UA_MonitoringParameters, queueSize) - sizeof(UA_UInt32),
8762  .isArray = false
8763  },};
8764 
8765 /* SignatureData */
8766 static UA_DataTypeMember SignatureData_members[2] = {
8768 #ifdef UA_ENABLE_TYPENAMES
8769  .memberName = "algorithm",
8770 #endif
8771  .namespaceZero = true,
8772  .padding = 0,
8773  .isArray = false
8774  },
8775  { .memberTypeIndex = UA_TYPES_BYTESTRING,
8776 #ifdef UA_ENABLE_TYPENAMES
8777  .memberName = "signature",
8778 #endif
8779  .namespaceZero = true,
8780  .padding = offsetof(UA_SignatureData, signature) - offsetof(UA_SignatureData, algorithm) - sizeof(UA_String),
8781  .isArray = false
8782  },};
8783 
8784 /* ReferenceNode */
8785 static UA_DataTypeMember ReferenceNode_members[3] = {
8787 #ifdef UA_ENABLE_TYPENAMES
8788  .memberName = "referenceTypeId",
8789 #endif
8790  .namespaceZero = true,
8791  .padding = 0,
8792  .isArray = false
8793  },
8794  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8795 #ifdef UA_ENABLE_TYPENAMES
8796  .memberName = "isInverse",
8797 #endif
8798  .namespaceZero = true,
8799  .padding = offsetof(UA_ReferenceNode, isInverse) - offsetof(UA_ReferenceNode, referenceTypeId) - sizeof(UA_NodeId),
8800  .isArray = false
8801  },
8802  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
8803 #ifdef UA_ENABLE_TYPENAMES
8804  .memberName = "targetId",
8805 #endif
8806  .namespaceZero = true,
8807  .padding = offsetof(UA_ReferenceNode, targetId) - offsetof(UA_ReferenceNode, isInverse) - sizeof(UA_Boolean),
8808  .isArray = false
8809  },};
8810 
8811 /* Argument */
8812 static UA_DataTypeMember Argument_members[5] = {
8814 #ifdef UA_ENABLE_TYPENAMES
8815  .memberName = "name",
8816 #endif
8817  .namespaceZero = true,
8818  .padding = 0,
8819  .isArray = false
8820  },
8821  { .memberTypeIndex = UA_TYPES_NODEID,
8822 #ifdef UA_ENABLE_TYPENAMES
8823  .memberName = "dataType",
8824 #endif
8825  .namespaceZero = true,
8826  .padding = offsetof(UA_Argument, dataType) - offsetof(UA_Argument, name) - sizeof(UA_String),
8827  .isArray = false
8828  },
8829  { .memberTypeIndex = UA_TYPES_INT32,
8830 #ifdef UA_ENABLE_TYPENAMES
8831  .memberName = "valueRank",
8832 #endif
8833  .namespaceZero = true,
8834  .padding = offsetof(UA_Argument, valueRank) - offsetof(UA_Argument, dataType) - sizeof(UA_NodeId),
8835  .isArray = false
8836  },
8837  { .memberTypeIndex = UA_TYPES_UINT32,
8838 #ifdef UA_ENABLE_TYPENAMES
8839  .memberName = "arrayDimensions",
8840 #endif
8841  .namespaceZero = true,
8842  .padding = offsetof(UA_Argument, arrayDimensionsSize) - offsetof(UA_Argument, valueRank) - sizeof(UA_Int32),
8843  .isArray = true
8844  },
8845  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8846 #ifdef UA_ENABLE_TYPENAMES
8847  .memberName = "description",
8848 #endif
8849  .namespaceZero = true,
8850  .padding = offsetof(UA_Argument, description) - offsetof(UA_Argument, arrayDimensions) - sizeof(void*),
8851  .isArray = false
8852  },};
8853 
8854 /* UserIdentityToken */
8855 static UA_DataTypeMember UserIdentityToken_members[1] = {
8857 #ifdef UA_ENABLE_TYPENAMES
8858  .memberName = "policyId",
8859 #endif
8860  .namespaceZero = true,
8861  .padding = 0,
8862  .isArray = false
8863  },};
8864 
8865 /* ObjectTypeAttributes */
8866 static UA_DataTypeMember ObjectTypeAttributes_members[6] = {
8868 #ifdef UA_ENABLE_TYPENAMES
8869  .memberName = "specifiedAttributes",
8870 #endif
8871  .namespaceZero = true,
8872  .padding = 0,
8873  .isArray = false
8874  },
8875  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8876 #ifdef UA_ENABLE_TYPENAMES
8877  .memberName = "displayName",
8878 #endif
8879  .namespaceZero = true,
8880  .padding = offsetof(UA_ObjectTypeAttributes, displayName) - offsetof(UA_ObjectTypeAttributes, specifiedAttributes) - sizeof(UA_UInt32),
8881  .isArray = false
8882  },
8883  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
8884 #ifdef UA_ENABLE_TYPENAMES
8885  .memberName = "description",
8886 #endif
8887  .namespaceZero = true,
8888  .padding = offsetof(UA_ObjectTypeAttributes, description) - offsetof(UA_ObjectTypeAttributes, displayName) - sizeof(UA_LocalizedText),
8889  .isArray = false
8890  },
8891  { .memberTypeIndex = UA_TYPES_UINT32,
8892 #ifdef UA_ENABLE_TYPENAMES
8893  .memberName = "writeMask",
8894 #endif
8895  .namespaceZero = true,
8896  .padding = offsetof(UA_ObjectTypeAttributes, writeMask) - offsetof(UA_ObjectTypeAttributes, description) - sizeof(UA_LocalizedText),
8897  .isArray = false
8898  },
8899  { .memberTypeIndex = UA_TYPES_UINT32,
8900 #ifdef UA_ENABLE_TYPENAMES
8901  .memberName = "userWriteMask",
8902 #endif
8903  .namespaceZero = true,
8904  .padding = offsetof(UA_ObjectTypeAttributes, userWriteMask) - offsetof(UA_ObjectTypeAttributes, writeMask) - sizeof(UA_UInt32),
8905  .isArray = false
8906  },
8907  { .memberTypeIndex = UA_TYPES_BOOLEAN,
8908 #ifdef UA_ENABLE_TYPENAMES
8909  .memberName = "isAbstract",
8910 #endif
8911  .namespaceZero = true,
8912  .padding = offsetof(UA_ObjectTypeAttributes, isAbstract) - offsetof(UA_ObjectTypeAttributes, userWriteMask) - sizeof(UA_UInt32),
8913  .isArray = false
8914  },};
8915 
8916 /* DeadbandType */
8917 static UA_DataTypeMember DeadbandType_members[1] = {
8919 #ifdef UA_ENABLE_TYPENAMES
8920  .memberName = "",
8921 #endif
8922  .namespaceZero = true,
8923  .padding = 0,
8924  .isArray = false
8925  },};
8926 
8927 /* SecurityTokenRequestType */
8928 static UA_DataTypeMember SecurityTokenRequestType_members[1] = {
8930 #ifdef UA_ENABLE_TYPENAMES
8931  .memberName = "",
8932 #endif
8933  .namespaceZero = true,
8934  .padding = 0,
8935  .isArray = false
8936  },};
8937 
8938 /* DataChangeTrigger */
8939 static UA_DataTypeMember DataChangeTrigger_members[1] = {
8941 #ifdef UA_ENABLE_TYPENAMES
8942  .memberName = "",
8943 #endif
8944  .namespaceZero = true,
8945  .padding = 0,
8946  .isArray = false
8947  },};
8948 
8949 /* BuildInfo */
8950 static UA_DataTypeMember BuildInfo_members[6] = {
8952 #ifdef UA_ENABLE_TYPENAMES
8953  .memberName = "productUri",
8954 #endif
8955  .namespaceZero = true,
8956  .padding = 0,
8957  .isArray = false
8958  },
8959  { .memberTypeIndex = UA_TYPES_STRING,
8960 #ifdef UA_ENABLE_TYPENAMES
8961  .memberName = "manufacturerName",
8962 #endif
8963  .namespaceZero = true,
8964  .padding = offsetof(UA_BuildInfo, manufacturerName) - offsetof(UA_BuildInfo, productUri) - sizeof(UA_String),
8965  .isArray = false
8966  },
8967  { .memberTypeIndex = UA_TYPES_STRING,
8968 #ifdef UA_ENABLE_TYPENAMES
8969  .memberName = "productName",
8970 #endif
8971  .namespaceZero = true,
8972  .padding = offsetof(UA_BuildInfo, productName) - offsetof(UA_BuildInfo, manufacturerName) - sizeof(UA_String),
8973  .isArray = false
8974  },
8975  { .memberTypeIndex = UA_TYPES_STRING,
8976 #ifdef UA_ENABLE_TYPENAMES
8977  .memberName = "softwareVersion",
8978 #endif
8979  .namespaceZero = true,
8980  .padding = offsetof(UA_BuildInfo, softwareVersion) - offsetof(UA_BuildInfo, productName) - sizeof(UA_String),
8981  .isArray = false
8982  },
8983  { .memberTypeIndex = UA_TYPES_STRING,
8984 #ifdef UA_ENABLE_TYPENAMES
8985  .memberName = "buildNumber",
8986 #endif
8987  .namespaceZero = true,
8988  .padding = offsetof(UA_BuildInfo, buildNumber) - offsetof(UA_BuildInfo, softwareVersion) - sizeof(UA_String),
8989  .isArray = false
8990  },
8991  { .memberTypeIndex = UA_TYPES_DATETIME,
8992 #ifdef UA_ENABLE_TYPENAMES
8993  .memberName = "buildDate",
8994 #endif
8995  .namespaceZero = true,
8996  .padding = offsetof(UA_BuildInfo, buildDate) - offsetof(UA_BuildInfo, buildNumber) - sizeof(UA_String),
8997  .isArray = false
8998  },};
8999 
9000 /* NodeClass */
9001 static UA_DataTypeMember NodeClass_members[1] = {
9003 #ifdef UA_ENABLE_TYPENAMES
9004  .memberName = "",
9005 #endif
9006  .namespaceZero = true,
9007  .padding = 0,
9008  .isArray = false
9009  },};
9010 
9011 /* ChannelSecurityToken */
9012 static UA_DataTypeMember ChannelSecurityToken_members[4] = {
9014 #ifdef UA_ENABLE_TYPENAMES
9015  .memberName = "channelId",
9016 #endif
9017  .namespaceZero = true,
9018  .padding = 0,
9019  .isArray = false
9020  },
9021  { .memberTypeIndex = UA_TYPES_UINT32,
9022 #ifdef UA_ENABLE_TYPENAMES
9023  .memberName = "tokenId",
9024 #endif
9025  .namespaceZero = true,
9026  .padding = offsetof(UA_ChannelSecurityToken, tokenId) - offsetof(UA_ChannelSecurityToken, channelId) - sizeof(UA_UInt32),
9027  .isArray = false
9028  },
9029  { .memberTypeIndex = UA_TYPES_DATETIME,
9030 #ifdef UA_ENABLE_TYPENAMES
9031  .memberName = "createdAt",
9032 #endif
9033  .namespaceZero = true,
9034  .padding = offsetof(UA_ChannelSecurityToken, createdAt) - offsetof(UA_ChannelSecurityToken, tokenId) - sizeof(UA_UInt32),
9035  .isArray = false
9036  },
9037  { .memberTypeIndex = UA_TYPES_UINT32,
9038 #ifdef UA_ENABLE_TYPENAMES
9039  .memberName = "revisedLifetime",
9040 #endif
9041  .namespaceZero = true,
9042  .padding = offsetof(UA_ChannelSecurityToken, revisedLifetime) - offsetof(UA_ChannelSecurityToken, createdAt) - sizeof(UA_DateTime),
9043  .isArray = false
9044  },};
9045 
9046 /* MonitoredItemNotification */
9047 static UA_DataTypeMember MonitoredItemNotification_members[2] = {
9049 #ifdef UA_ENABLE_TYPENAMES
9050  .memberName = "clientHandle",
9051 #endif
9052  .namespaceZero = true,
9053  .padding = 0,
9054  .isArray = false
9055  },
9056  { .memberTypeIndex = UA_TYPES_DATAVALUE,
9057 #ifdef UA_ENABLE_TYPENAMES
9058  .memberName = "value",
9059 #endif
9060  .namespaceZero = true,
9061  .padding = offsetof(UA_MonitoredItemNotification, value) - offsetof(UA_MonitoredItemNotification, clientHandle) - sizeof(UA_UInt32),
9062  .isArray = false
9063  },};
9064 
9065 /* DeleteNodesItem */
9066 static UA_DataTypeMember DeleteNodesItem_members[2] = {
9068 #ifdef UA_ENABLE_TYPENAMES
9069  .memberName = "nodeId",
9070 #endif
9071  .namespaceZero = true,
9072  .padding = 0,
9073  .isArray = false
9074  },
9075  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9076 #ifdef UA_ENABLE_TYPENAMES
9077  .memberName = "deleteTargetReferences",
9078 #endif
9079  .namespaceZero = true,
9080  .padding = offsetof(UA_DeleteNodesItem, deleteTargetReferences) - offsetof(UA_DeleteNodesItem, nodeId) - sizeof(UA_NodeId),
9081  .isArray = false
9082  },};
9083 
9084 /* SubscriptionAcknowledgement */
9085 static UA_DataTypeMember SubscriptionAcknowledgement_members[2] = {
9087 #ifdef UA_ENABLE_TYPENAMES
9088  .memberName = "subscriptionId",
9089 #endif
9090  .namespaceZero = true,
9091  .padding = 0,
9092  .isArray = false
9093  },
9094  { .memberTypeIndex = UA_TYPES_UINT32,
9095 #ifdef UA_ENABLE_TYPENAMES
9096  .memberName = "sequenceNumber",
9097 #endif
9098  .namespaceZero = true,
9099  .padding = offsetof(UA_SubscriptionAcknowledgement, sequenceNumber) - offsetof(UA_SubscriptionAcknowledgement, subscriptionId) - sizeof(UA_UInt32),
9100  .isArray = false
9101  },};
9102 
9103 /* ReadValueId */
9104 static UA_DataTypeMember ReadValueId_members[4] = {
9106 #ifdef UA_ENABLE_TYPENAMES
9107  .memberName = "nodeId",
9108 #endif
9109  .namespaceZero = true,
9110  .padding = 0,
9111  .isArray = false
9112  },
9113  { .memberTypeIndex = UA_TYPES_UINT32,
9114 #ifdef UA_ENABLE_TYPENAMES
9115  .memberName = "attributeId",
9116 #endif
9117  .namespaceZero = true,
9118  .padding = offsetof(UA_ReadValueId, attributeId) - offsetof(UA_ReadValueId, nodeId) - sizeof(UA_NodeId),
9119  .isArray = false
9120  },
9121  { .memberTypeIndex = UA_TYPES_STRING,
9122 #ifdef UA_ENABLE_TYPENAMES
9123  .memberName = "indexRange",
9124 #endif
9125  .namespaceZero = true,
9126  .padding = offsetof(UA_ReadValueId, indexRange) - offsetof(UA_ReadValueId, attributeId) - sizeof(UA_UInt32),
9127  .isArray = false
9128  },
9129  { .memberTypeIndex = UA_TYPES_QUALIFIEDNAME,
9130 #ifdef UA_ENABLE_TYPENAMES
9131  .memberName = "dataEncoding",
9132 #endif
9133  .namespaceZero = true,
9134  .padding = offsetof(UA_ReadValueId, dataEncoding) - offsetof(UA_ReadValueId, indexRange) - sizeof(UA_String),
9135  .isArray = false
9136  },};
9137 
9138 /* DataTypeAttributes */
9139 static UA_DataTypeMember DataTypeAttributes_members[6] = {
9141 #ifdef UA_ENABLE_TYPENAMES
9142  .memberName = "specifiedAttributes",
9143 #endif
9144  .namespaceZero = true,
9145  .padding = 0,
9146  .isArray = false
9147  },
9148  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9149 #ifdef UA_ENABLE_TYPENAMES
9150  .memberName = "displayName",
9151 #endif
9152  .namespaceZero = true,
9153  .padding = offsetof(UA_DataTypeAttributes, displayName) - offsetof(UA_DataTypeAttributes, specifiedAttributes) - sizeof(UA_UInt32),
9154  .isArray = false
9155  },
9156  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9157 #ifdef UA_ENABLE_TYPENAMES
9158  .memberName = "description",
9159 #endif
9160  .namespaceZero = true,
9161  .padding = offsetof(UA_DataTypeAttributes, description) - offsetof(UA_DataTypeAttributes, displayName) - sizeof(UA_LocalizedText),
9162  .isArray = false
9163  },
9164  { .memberTypeIndex = UA_TYPES_UINT32,
9165 #ifdef UA_ENABLE_TYPENAMES
9166  .memberName = "writeMask",
9167 #endif
9168  .namespaceZero = true,
9169  .padding = offsetof(UA_DataTypeAttributes, writeMask) - offsetof(UA_DataTypeAttributes, description) - sizeof(UA_LocalizedText),
9170  .isArray = false
9171  },
9172  { .memberTypeIndex = UA_TYPES_UINT32,
9173 #ifdef UA_ENABLE_TYPENAMES
9174  .memberName = "userWriteMask",
9175 #endif
9176  .namespaceZero = true,
9177  .padding = offsetof(UA_DataTypeAttributes, userWriteMask) - offsetof(UA_DataTypeAttributes, writeMask) - sizeof(UA_UInt32),
9178  .isArray = false
9179  },
9180  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9181 #ifdef UA_ENABLE_TYPENAMES
9182  .memberName = "isAbstract",
9183 #endif
9184  .namespaceZero = true,
9185  .padding = offsetof(UA_DataTypeAttributes, isAbstract) - offsetof(UA_DataTypeAttributes, userWriteMask) - sizeof(UA_UInt32),
9186  .isArray = false
9187  },};
9188 
9189 /* ResponseHeader */
9190 static UA_DataTypeMember ResponseHeader_members[6] = {
9192 #ifdef UA_ENABLE_TYPENAMES
9193  .memberName = "timestamp",
9194 #endif
9195  .namespaceZero = true,
9196  .padding = 0,
9197  .isArray = false
9198  },
9199  { .memberTypeIndex = UA_TYPES_UINT32,
9200 #ifdef UA_ENABLE_TYPENAMES
9201  .memberName = "requestHandle",
9202 #endif
9203  .namespaceZero = true,
9204  .padding = offsetof(UA_ResponseHeader, requestHandle) - offsetof(UA_ResponseHeader, timestamp) - sizeof(UA_DateTime),
9205  .isArray = false
9206  },
9207  { .memberTypeIndex = UA_TYPES_STATUSCODE,
9208 #ifdef UA_ENABLE_TYPENAMES
9209  .memberName = "serviceResult",
9210 #endif
9211  .namespaceZero = true,
9212  .padding = offsetof(UA_ResponseHeader, serviceResult) - offsetof(UA_ResponseHeader, requestHandle) - sizeof(UA_UInt32),
9213  .isArray = false
9214  },
9215  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
9216 #ifdef UA_ENABLE_TYPENAMES
9217  .memberName = "serviceDiagnostics",
9218 #endif
9219  .namespaceZero = true,
9220  .padding = offsetof(UA_ResponseHeader, serviceDiagnostics) - offsetof(UA_ResponseHeader, serviceResult) - sizeof(UA_StatusCode),
9221  .isArray = false
9222  },
9223  { .memberTypeIndex = UA_TYPES_STRING,
9224 #ifdef UA_ENABLE_TYPENAMES
9225  .memberName = "stringTable",
9226 #endif
9227  .namespaceZero = true,
9228  .padding = offsetof(UA_ResponseHeader, stringTableSize) - offsetof(UA_ResponseHeader, serviceDiagnostics) - sizeof(UA_DiagnosticInfo),
9229  .isArray = true
9230  },
9231  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
9232 #ifdef UA_ENABLE_TYPENAMES
9233  .memberName = "additionalHeader",
9234 #endif
9235  .namespaceZero = true,
9236  .padding = offsetof(UA_ResponseHeader, additionalHeader) - offsetof(UA_ResponseHeader, stringTable) - sizeof(void*),
9237  .isArray = false
9238  },};
9239 
9240 /* DeleteSubscriptionsRequest */
9241 static UA_DataTypeMember DeleteSubscriptionsRequest_members[2] = {
9243 #ifdef UA_ENABLE_TYPENAMES
9244  .memberName = "requestHeader",
9245 #endif
9246  .namespaceZero = true,
9247  .padding = 0,
9248  .isArray = false
9249  },
9250  { .memberTypeIndex = UA_TYPES_UINT32,
9251 #ifdef UA_ENABLE_TYPENAMES
9252  .memberName = "subscriptionIds",
9253 #endif
9254  .namespaceZero = true,
9255  .padding = offsetof(UA_DeleteSubscriptionsRequest, subscriptionIdsSize) - offsetof(UA_DeleteSubscriptionsRequest, requestHeader) - sizeof(UA_RequestHeader),
9256  .isArray = true
9257  },};
9258 
9259 /* ViewDescription */
9260 static UA_DataTypeMember ViewDescription_members[3] = {
9262 #ifdef UA_ENABLE_TYPENAMES
9263  .memberName = "viewId",
9264 #endif
9265  .namespaceZero = true,
9266  .padding = 0,
9267  .isArray = false
9268  },
9269  { .memberTypeIndex = UA_TYPES_DATETIME,
9270 #ifdef UA_ENABLE_TYPENAMES
9271  .memberName = "timestamp",
9272 #endif
9273  .namespaceZero = true,
9274  .padding = offsetof(UA_ViewDescription, timestamp) - offsetof(UA_ViewDescription, viewId) - sizeof(UA_NodeId),
9275  .isArray = false
9276  },
9277  { .memberTypeIndex = UA_TYPES_UINT32,
9278 #ifdef UA_ENABLE_TYPENAMES
9279  .memberName = "viewVersion",
9280 #endif
9281  .namespaceZero = true,
9282  .padding = offsetof(UA_ViewDescription, viewVersion) - offsetof(UA_ViewDescription, timestamp) - sizeof(UA_DateTime),
9283  .isArray = false
9284  },};
9285 
9286 /* DeleteMonitoredItemsResponse */
9287 static UA_DataTypeMember DeleteMonitoredItemsResponse_members[3] = {
9289 #ifdef UA_ENABLE_TYPENAMES
9290  .memberName = "responseHeader",
9291 #endif
9292  .namespaceZero = true,
9293  .padding = 0,
9294  .isArray = false
9295  },
9296  { .memberTypeIndex = UA_TYPES_STATUSCODE,
9297 #ifdef UA_ENABLE_TYPENAMES
9298  .memberName = "results",
9299 #endif
9300  .namespaceZero = true,
9301  .padding = offsetof(UA_DeleteMonitoredItemsResponse, resultsSize) - offsetof(UA_DeleteMonitoredItemsResponse, responseHeader) - sizeof(UA_ResponseHeader),
9302  .isArray = true
9303  },
9304  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
9305 #ifdef UA_ENABLE_TYPENAMES
9306  .memberName = "diagnosticInfos",
9307 #endif
9308  .namespaceZero = true,
9309  .padding = offsetof(UA_DeleteMonitoredItemsResponse, diagnosticInfosSize) - offsetof(UA_DeleteMonitoredItemsResponse, results) - sizeof(void*),
9310  .isArray = true
9311  },};
9312 
9313 /* NodeAttributes */
9314 static UA_DataTypeMember NodeAttributes_members[5] = {
9316 #ifdef UA_ENABLE_TYPENAMES
9317  .memberName = "specifiedAttributes",
9318 #endif
9319  .namespaceZero = true,
9320  .padding = 0,
9321  .isArray = false
9322  },
9323  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9324 #ifdef UA_ENABLE_TYPENAMES
9325  .memberName = "displayName",
9326 #endif
9327  .namespaceZero = true,
9328  .padding = offsetof(UA_NodeAttributes, displayName) - offsetof(UA_NodeAttributes, specifiedAttributes) - sizeof(UA_UInt32),
9329  .isArray = false
9330  },
9331  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9332 #ifdef UA_ENABLE_TYPENAMES
9333  .memberName = "description",
9334 #endif
9335  .namespaceZero = true,
9336  .padding = offsetof(UA_NodeAttributes, description) - offsetof(UA_NodeAttributes, displayName) - sizeof(UA_LocalizedText),
9337  .isArray = false
9338  },
9339  { .memberTypeIndex = UA_TYPES_UINT32,
9340 #ifdef UA_ENABLE_TYPENAMES
9341  .memberName = "writeMask",
9342 #endif
9343  .namespaceZero = true,
9344  .padding = offsetof(UA_NodeAttributes, writeMask) - offsetof(UA_NodeAttributes, description) - sizeof(UA_LocalizedText),
9345  .isArray = false
9346  },
9347  { .memberTypeIndex = UA_TYPES_UINT32,
9348 #ifdef UA_ENABLE_TYPENAMES
9349  .memberName = "userWriteMask",
9350 #endif
9351  .namespaceZero = true,
9352  .padding = offsetof(UA_NodeAttributes, userWriteMask) - offsetof(UA_NodeAttributes, writeMask) - sizeof(UA_UInt32),
9353  .isArray = false
9354  },};
9355 
9356 /* RegisterNodesRequest */
9357 static UA_DataTypeMember RegisterNodesRequest_members[2] = {
9359 #ifdef UA_ENABLE_TYPENAMES
9360  .memberName = "requestHeader",
9361 #endif
9362  .namespaceZero = true,
9363  .padding = 0,
9364  .isArray = false
9365  },
9366  { .memberTypeIndex = UA_TYPES_NODEID,
9367 #ifdef UA_ENABLE_TYPENAMES
9368  .memberName = "nodesToRegister",
9369 #endif
9370  .namespaceZero = true,
9371  .padding = offsetof(UA_RegisterNodesRequest, nodesToRegisterSize) - offsetof(UA_RegisterNodesRequest, requestHeader) - sizeof(UA_RequestHeader),
9372  .isArray = true
9373  },};
9374 
9375 /* DeleteNodesRequest */
9376 static UA_DataTypeMember DeleteNodesRequest_members[2] = {
9378 #ifdef UA_ENABLE_TYPENAMES
9379  .memberName = "requestHeader",
9380 #endif
9381  .namespaceZero = true,
9382  .padding = 0,
9383  .isArray = false
9384  },
9385  { .memberTypeIndex = UA_TYPES_DELETENODESITEM,
9386 #ifdef UA_ENABLE_TYPENAMES
9387  .memberName = "nodesToDelete",
9388 #endif
9389  .namespaceZero = true,
9390  .padding = offsetof(UA_DeleteNodesRequest, nodesToDeleteSize) - offsetof(UA_DeleteNodesRequest, requestHeader) - sizeof(UA_RequestHeader),
9391  .isArray = true
9392  },};
9393 
9394 /* PublishResponse */
9395 static UA_DataTypeMember PublishResponse_members[7] = {
9397 #ifdef UA_ENABLE_TYPENAMES
9398  .memberName = "responseHeader",
9399 #endif
9400  .namespaceZero = true,
9401  .padding = 0,
9402  .isArray = false
9403  },
9404  { .memberTypeIndex = UA_TYPES_UINT32,
9405 #ifdef UA_ENABLE_TYPENAMES
9406  .memberName = "subscriptionId",
9407 #endif
9408  .namespaceZero = true,
9409  .padding = offsetof(UA_PublishResponse, subscriptionId) - offsetof(UA_PublishResponse, responseHeader) - sizeof(UA_ResponseHeader),
9410  .isArray = false
9411  },
9412  { .memberTypeIndex = UA_TYPES_UINT32,
9413 #ifdef UA_ENABLE_TYPENAMES
9414  .memberName = "availableSequenceNumbers",
9415 #endif
9416  .namespaceZero = true,
9417  .padding = offsetof(UA_PublishResponse, availableSequenceNumbersSize) - offsetof(UA_PublishResponse, subscriptionId) - sizeof(UA_UInt32),
9418  .isArray = true
9419  },
9420  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9421 #ifdef UA_ENABLE_TYPENAMES
9422  .memberName = "moreNotifications",
9423 #endif
9424  .namespaceZero = true,
9425  .padding = offsetof(UA_PublishResponse, moreNotifications) - offsetof(UA_PublishResponse, availableSequenceNumbers) - sizeof(void*),
9426  .isArray = false
9427  },
9428  { .memberTypeIndex = UA_TYPES_NOTIFICATIONMESSAGE,
9429 #ifdef UA_ENABLE_TYPENAMES
9430  .memberName = "notificationMessage",
9431 #endif
9432  .namespaceZero = true,
9433  .padding = offsetof(UA_PublishResponse, notificationMessage) - offsetof(UA_PublishResponse, moreNotifications) - sizeof(UA_Boolean),
9434  .isArray = false
9435  },
9436  { .memberTypeIndex = UA_TYPES_STATUSCODE,
9437 #ifdef UA_ENABLE_TYPENAMES
9438  .memberName = "results",
9439 #endif
9440  .namespaceZero = true,
9441  .padding = offsetof(UA_PublishResponse, resultsSize) - offsetof(UA_PublishResponse, notificationMessage) - sizeof(UA_NotificationMessage),
9442  .isArray = true
9443  },
9444  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
9445 #ifdef UA_ENABLE_TYPENAMES
9446  .memberName = "diagnosticInfos",
9447 #endif
9448  .namespaceZero = true,
9449  .padding = offsetof(UA_PublishResponse, diagnosticInfosSize) - offsetof(UA_PublishResponse, results) - sizeof(void*),
9450  .isArray = true
9451  },};
9452 
9453 /* MonitoredItemModifyRequest */
9454 static UA_DataTypeMember MonitoredItemModifyRequest_members[2] = {
9456 #ifdef UA_ENABLE_TYPENAMES
9457  .memberName = "monitoredItemId",
9458 #endif
9459  .namespaceZero = true,
9460  .padding = 0,
9461  .isArray = false
9462  },
9463  { .memberTypeIndex = UA_TYPES_MONITORINGPARAMETERS,
9464 #ifdef UA_ENABLE_TYPENAMES
9465  .memberName = "requestedParameters",
9466 #endif
9467  .namespaceZero = true,
9468  .padding = offsetof(UA_MonitoredItemModifyRequest, requestedParameters) - offsetof(UA_MonitoredItemModifyRequest, monitoredItemId) - sizeof(UA_UInt32),
9469  .isArray = false
9470  },};
9471 
9472 /* UserNameIdentityToken */
9473 static UA_DataTypeMember UserNameIdentityToken_members[4] = {
9475 #ifdef UA_ENABLE_TYPENAMES
9476  .memberName = "policyId",
9477 #endif
9478  .namespaceZero = true,
9479  .padding = 0,
9480  .isArray = false
9481  },
9482  { .memberTypeIndex = UA_TYPES_STRING,
9483 #ifdef UA_ENABLE_TYPENAMES
9484  .memberName = "userName",
9485 #endif
9486  .namespaceZero = true,
9487  .padding = offsetof(UA_UserNameIdentityToken, userName) - offsetof(UA_UserNameIdentityToken, policyId) - sizeof(UA_String),
9488  .isArray = false
9489  },
9490  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9491 #ifdef UA_ENABLE_TYPENAMES
9492  .memberName = "password",
9493 #endif
9494  .namespaceZero = true,
9495  .padding = offsetof(UA_UserNameIdentityToken, password) - offsetof(UA_UserNameIdentityToken, userName) - sizeof(UA_String),
9496  .isArray = false
9497  },
9498  { .memberTypeIndex = UA_TYPES_STRING,
9499 #ifdef UA_ENABLE_TYPENAMES
9500  .memberName = "encryptionAlgorithm",
9501 #endif
9502  .namespaceZero = true,
9503  .padding = offsetof(UA_UserNameIdentityToken, encryptionAlgorithm) - offsetof(UA_UserNameIdentityToken, password) - sizeof(UA_ByteString),
9504  .isArray = false
9505  },};
9506 
9507 /* IdType */
9508 static UA_DataTypeMember IdType_members[1] = {
9510 #ifdef UA_ENABLE_TYPENAMES
9511  .memberName = "",
9512 #endif
9513  .namespaceZero = true,
9514  .padding = 0,
9515  .isArray = false
9516  },};
9517 
9518 /* UserTokenType */
9519 static UA_DataTypeMember UserTokenType_members[1] = {
9521 #ifdef UA_ENABLE_TYPENAMES
9522  .memberName = "",
9523 #endif
9524  .namespaceZero = true,
9525  .padding = 0,
9526  .isArray = false
9527  },};
9528 
9529 /* ActivateSessionRequest */
9530 static UA_DataTypeMember ActivateSessionRequest_members[6] = {
9532 #ifdef UA_ENABLE_TYPENAMES
9533  .memberName = "requestHeader",
9534 #endif
9535  .namespaceZero = true,
9536  .padding = 0,
9537  .isArray = false
9538  },
9539  { .memberTypeIndex = UA_TYPES_SIGNATUREDATA,
9540 #ifdef UA_ENABLE_TYPENAMES
9541  .memberName = "clientSignature",
9542 #endif
9543  .namespaceZero = true,
9544  .padding = offsetof(UA_ActivateSessionRequest, clientSignature) - offsetof(UA_ActivateSessionRequest, requestHeader) - sizeof(UA_RequestHeader),
9545  .isArray = false
9546  },
9547  { .memberTypeIndex = UA_TYPES_SIGNEDSOFTWARECERTIFICATE,
9548 #ifdef UA_ENABLE_TYPENAMES
9549  .memberName = "clientSoftwareCertificates",
9550 #endif
9551  .namespaceZero = true,
9552  .padding = offsetof(UA_ActivateSessionRequest, clientSoftwareCertificatesSize) - offsetof(UA_ActivateSessionRequest, clientSignature) - sizeof(UA_SignatureData),
9553  .isArray = true
9554  },
9555  { .memberTypeIndex = UA_TYPES_STRING,
9556 #ifdef UA_ENABLE_TYPENAMES
9557  .memberName = "localeIds",
9558 #endif
9559  .namespaceZero = true,
9560  .padding = offsetof(UA_ActivateSessionRequest, localeIdsSize) - offsetof(UA_ActivateSessionRequest, clientSoftwareCertificates) - sizeof(void*),
9561  .isArray = true
9562  },
9563  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
9564 #ifdef UA_ENABLE_TYPENAMES
9565  .memberName = "userIdentityToken",
9566 #endif
9567  .namespaceZero = true,
9568  .padding = offsetof(UA_ActivateSessionRequest, userIdentityToken) - offsetof(UA_ActivateSessionRequest, localeIds) - sizeof(void*),
9569  .isArray = false
9570  },
9571  { .memberTypeIndex = UA_TYPES_SIGNATUREDATA,
9572 #ifdef UA_ENABLE_TYPENAMES
9573  .memberName = "userTokenSignature",
9574 #endif
9575  .namespaceZero = true,
9576  .padding = offsetof(UA_ActivateSessionRequest, userTokenSignature) - offsetof(UA_ActivateSessionRequest, userIdentityToken) - sizeof(UA_ExtensionObject),
9577  .isArray = false
9578  },};
9579 
9580 /* OpenSecureChannelResponse */
9581 static UA_DataTypeMember OpenSecureChannelResponse_members[4] = {
9583 #ifdef UA_ENABLE_TYPENAMES
9584  .memberName = "responseHeader",
9585 #endif
9586  .namespaceZero = true,
9587  .padding = 0,
9588  .isArray = false
9589  },
9590  { .memberTypeIndex = UA_TYPES_UINT32,
9591 #ifdef UA_ENABLE_TYPENAMES
9592  .memberName = "serverProtocolVersion",
9593 #endif
9594  .namespaceZero = true,
9595  .padding = offsetof(UA_OpenSecureChannelResponse, serverProtocolVersion) - offsetof(UA_OpenSecureChannelResponse, responseHeader) - sizeof(UA_ResponseHeader),
9596  .isArray = false
9597  },
9598  { .memberTypeIndex = UA_TYPES_CHANNELSECURITYTOKEN,
9599 #ifdef UA_ENABLE_TYPENAMES
9600  .memberName = "securityToken",
9601 #endif
9602  .namespaceZero = true,
9603  .padding = offsetof(UA_OpenSecureChannelResponse, securityToken) - offsetof(UA_OpenSecureChannelResponse, serverProtocolVersion) - sizeof(UA_UInt32),
9604  .isArray = false
9605  },
9606  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9607 #ifdef UA_ENABLE_TYPENAMES
9608  .memberName = "serverNonce",
9609 #endif
9610  .namespaceZero = true,
9611  .padding = offsetof(UA_OpenSecureChannelResponse, serverNonce) - offsetof(UA_OpenSecureChannelResponse, securityToken) - sizeof(UA_ChannelSecurityToken),
9612  .isArray = false
9613  },};
9614 
9615 /* ApplicationType */
9616 static UA_DataTypeMember ApplicationType_members[1] = {
9618 #ifdef UA_ENABLE_TYPENAMES
9619  .memberName = "",
9620 #endif
9621  .namespaceZero = true,
9622  .padding = 0,
9623  .isArray = false
9624  },};
9625 
9626 /* ServerState */
9627 static UA_DataTypeMember ServerState_members[1] = {
9629 #ifdef UA_ENABLE_TYPENAMES
9630  .memberName = "",
9631 #endif
9632  .namespaceZero = true,
9633  .padding = 0,
9634  .isArray = false
9635  },};
9636 
9637 /* QueryNextResponse */
9638 static UA_DataTypeMember QueryNextResponse_members[3] = {
9640 #ifdef UA_ENABLE_TYPENAMES
9641  .memberName = "responseHeader",
9642 #endif
9643  .namespaceZero = true,
9644  .padding = 0,
9645  .isArray = false
9646  },
9647  { .memberTypeIndex = UA_TYPES_QUERYDATASET,
9648 #ifdef UA_ENABLE_TYPENAMES
9649  .memberName = "queryDataSets",
9650 #endif
9651  .namespaceZero = true,
9652  .padding = offsetof(UA_QueryNextResponse, queryDataSetsSize) - offsetof(UA_QueryNextResponse, responseHeader) - sizeof(UA_ResponseHeader),
9653  .isArray = true
9654  },
9655  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9656 #ifdef UA_ENABLE_TYPENAMES
9657  .memberName = "revisedContinuationPoint",
9658 #endif
9659  .namespaceZero = true,
9660  .padding = offsetof(UA_QueryNextResponse, revisedContinuationPoint) - offsetof(UA_QueryNextResponse, queryDataSets) - sizeof(void*),
9661  .isArray = false
9662  },};
9663 
9664 /* ActivateSessionResponse */
9665 static UA_DataTypeMember ActivateSessionResponse_members[4] = {
9667 #ifdef UA_ENABLE_TYPENAMES
9668  .memberName = "responseHeader",
9669 #endif
9670  .namespaceZero = true,
9671  .padding = 0,
9672  .isArray = false
9673  },
9674  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9675 #ifdef UA_ENABLE_TYPENAMES
9676  .memberName = "serverNonce",
9677 #endif
9678  .namespaceZero = true,
9679  .padding = offsetof(UA_ActivateSessionResponse, serverNonce) - offsetof(UA_ActivateSessionResponse, responseHeader) - sizeof(UA_ResponseHeader),
9680  .isArray = false
9681  },
9682  { .memberTypeIndex = UA_TYPES_STATUSCODE,
9683 #ifdef UA_ENABLE_TYPENAMES
9684  .memberName = "results",
9685 #endif
9686  .namespaceZero = true,
9687  .padding = offsetof(UA_ActivateSessionResponse, resultsSize) - offsetof(UA_ActivateSessionResponse, serverNonce) - sizeof(UA_ByteString),
9688  .isArray = true
9689  },
9690  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
9691 #ifdef UA_ENABLE_TYPENAMES
9692  .memberName = "diagnosticInfos",
9693 #endif
9694  .namespaceZero = true,
9695  .padding = offsetof(UA_ActivateSessionResponse, diagnosticInfosSize) - offsetof(UA_ActivateSessionResponse, results) - sizeof(void*),
9696  .isArray = true
9697  },};
9698 
9699 /* FilterOperator */
9700 static UA_DataTypeMember FilterOperator_members[1] = {
9702 #ifdef UA_ENABLE_TYPENAMES
9703  .memberName = "",
9704 #endif
9705  .namespaceZero = true,
9706  .padding = 0,
9707  .isArray = false
9708  },};
9709 
9710 /* QueryNextRequest */
9711 static UA_DataTypeMember QueryNextRequest_members[3] = {
9713 #ifdef UA_ENABLE_TYPENAMES
9714  .memberName = "requestHeader",
9715 #endif
9716  .namespaceZero = true,
9717  .padding = 0,
9718  .isArray = false
9719  },
9720  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9721 #ifdef UA_ENABLE_TYPENAMES
9722  .memberName = "releaseContinuationPoint",
9723 #endif
9724  .namespaceZero = true,
9725  .padding = offsetof(UA_QueryNextRequest, releaseContinuationPoint) - offsetof(UA_QueryNextRequest, requestHeader) - sizeof(UA_RequestHeader),
9726  .isArray = false
9727  },
9728  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9729 #ifdef UA_ENABLE_TYPENAMES
9730  .memberName = "continuationPoint",
9731 #endif
9732  .namespaceZero = true,
9733  .padding = offsetof(UA_QueryNextRequest, continuationPoint) - offsetof(UA_QueryNextRequest, releaseContinuationPoint) - sizeof(UA_Boolean),
9734  .isArray = false
9735  },};
9736 
9737 /* WriteResponse */
9738 static UA_DataTypeMember WriteResponse_members[3] = {
9740 #ifdef UA_ENABLE_TYPENAMES
9741  .memberName = "responseHeader",
9742 #endif
9743  .namespaceZero = true,
9744  .padding = 0,
9745  .isArray = false
9746  },
9747  { .memberTypeIndex = UA_TYPES_STATUSCODE,
9748 #ifdef UA_ENABLE_TYPENAMES
9749  .memberName = "results",
9750 #endif
9751  .namespaceZero = true,
9752  .padding = offsetof(UA_WriteResponse, resultsSize) - offsetof(UA_WriteResponse, responseHeader) - sizeof(UA_ResponseHeader),
9753  .isArray = true
9754  },
9755  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
9756 #ifdef UA_ENABLE_TYPENAMES
9757  .memberName = "diagnosticInfos",
9758 #endif
9759  .namespaceZero = true,
9760  .padding = offsetof(UA_WriteResponse, diagnosticInfosSize) - offsetof(UA_WriteResponse, results) - sizeof(void*),
9761  .isArray = true
9762  },};
9763 
9764 /* BrowseNextRequest */
9765 static UA_DataTypeMember BrowseNextRequest_members[3] = {
9767 #ifdef UA_ENABLE_TYPENAMES
9768  .memberName = "requestHeader",
9769 #endif
9770  .namespaceZero = true,
9771  .padding = 0,
9772  .isArray = false
9773  },
9774  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9775 #ifdef UA_ENABLE_TYPENAMES
9776  .memberName = "releaseContinuationPoints",
9777 #endif
9778  .namespaceZero = true,
9779  .padding = offsetof(UA_BrowseNextRequest, releaseContinuationPoints) - offsetof(UA_BrowseNextRequest, requestHeader) - sizeof(UA_RequestHeader),
9780  .isArray = false
9781  },
9782  { .memberTypeIndex = UA_TYPES_BYTESTRING,
9783 #ifdef UA_ENABLE_TYPENAMES
9784  .memberName = "continuationPoints",
9785 #endif
9786  .namespaceZero = true,
9787  .padding = offsetof(UA_BrowseNextRequest, continuationPointsSize) - offsetof(UA_BrowseNextRequest, releaseContinuationPoints) - sizeof(UA_Boolean),
9788  .isArray = true
9789  },};
9790 
9791 /* CreateSubscriptionRequest */
9792 static UA_DataTypeMember CreateSubscriptionRequest_members[7] = {
9794 #ifdef UA_ENABLE_TYPENAMES
9795  .memberName = "requestHeader",
9796 #endif
9797  .namespaceZero = true,
9798  .padding = 0,
9799  .isArray = false
9800  },
9801  { .memberTypeIndex = UA_TYPES_DOUBLE,
9802 #ifdef UA_ENABLE_TYPENAMES
9803  .memberName = "requestedPublishingInterval",
9804 #endif
9805  .namespaceZero = true,
9806  .padding = offsetof(UA_CreateSubscriptionRequest, requestedPublishingInterval) - offsetof(UA_CreateSubscriptionRequest, requestHeader) - sizeof(UA_RequestHeader),
9807  .isArray = false
9808  },
9809  { .memberTypeIndex = UA_TYPES_UINT32,
9810 #ifdef UA_ENABLE_TYPENAMES
9811  .memberName = "requestedLifetimeCount",
9812 #endif
9813  .namespaceZero = true,
9814  .padding = offsetof(UA_CreateSubscriptionRequest, requestedLifetimeCount) - offsetof(UA_CreateSubscriptionRequest, requestedPublishingInterval) - sizeof(UA_Double),
9815  .isArray = false
9816  },
9817  { .memberTypeIndex = UA_TYPES_UINT32,
9818 #ifdef UA_ENABLE_TYPENAMES
9819  .memberName = "requestedMaxKeepAliveCount",
9820 #endif
9821  .namespaceZero = true,
9822  .padding = offsetof(UA_CreateSubscriptionRequest, requestedMaxKeepAliveCount) - offsetof(UA_CreateSubscriptionRequest, requestedLifetimeCount) - sizeof(UA_UInt32),
9823  .isArray = false
9824  },
9825  { .memberTypeIndex = UA_TYPES_UINT32,
9826 #ifdef UA_ENABLE_TYPENAMES
9827  .memberName = "maxNotificationsPerPublish",
9828 #endif
9829  .namespaceZero = true,
9830  .padding = offsetof(UA_CreateSubscriptionRequest, maxNotificationsPerPublish) - offsetof(UA_CreateSubscriptionRequest, requestedMaxKeepAliveCount) - sizeof(UA_UInt32),
9831  .isArray = false
9832  },
9833  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9834 #ifdef UA_ENABLE_TYPENAMES
9835  .memberName = "publishingEnabled",
9836 #endif
9837  .namespaceZero = true,
9838  .padding = offsetof(UA_CreateSubscriptionRequest, publishingEnabled) - offsetof(UA_CreateSubscriptionRequest, maxNotificationsPerPublish) - sizeof(UA_UInt32),
9839  .isArray = false
9840  },
9841  { .memberTypeIndex = UA_TYPES_BYTE,
9842 #ifdef UA_ENABLE_TYPENAMES
9843  .memberName = "priority",
9844 #endif
9845  .namespaceZero = true,
9846  .padding = offsetof(UA_CreateSubscriptionRequest, priority) - offsetof(UA_CreateSubscriptionRequest, publishingEnabled) - sizeof(UA_Boolean),
9847  .isArray = false
9848  },};
9849 
9850 /* VariableTypeAttributes */
9851 static UA_DataTypeMember VariableTypeAttributes_members[10] = {
9853 #ifdef UA_ENABLE_TYPENAMES
9854  .memberName = "specifiedAttributes",
9855 #endif
9856  .namespaceZero = true,
9857  .padding = 0,
9858  .isArray = false
9859  },
9860  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9861 #ifdef UA_ENABLE_TYPENAMES
9862  .memberName = "displayName",
9863 #endif
9864  .namespaceZero = true,
9865  .padding = offsetof(UA_VariableTypeAttributes, displayName) - offsetof(UA_VariableTypeAttributes, specifiedAttributes) - sizeof(UA_UInt32),
9866  .isArray = false
9867  },
9868  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
9869 #ifdef UA_ENABLE_TYPENAMES
9870  .memberName = "description",
9871 #endif
9872  .namespaceZero = true,
9873  .padding = offsetof(UA_VariableTypeAttributes, description) - offsetof(UA_VariableTypeAttributes, displayName) - sizeof(UA_LocalizedText),
9874  .isArray = false
9875  },
9876  { .memberTypeIndex = UA_TYPES_UINT32,
9877 #ifdef UA_ENABLE_TYPENAMES
9878  .memberName = "writeMask",
9879 #endif
9880  .namespaceZero = true,
9881  .padding = offsetof(UA_VariableTypeAttributes, writeMask) - offsetof(UA_VariableTypeAttributes, description) - sizeof(UA_LocalizedText),
9882  .isArray = false
9883  },
9884  { .memberTypeIndex = UA_TYPES_UINT32,
9885 #ifdef UA_ENABLE_TYPENAMES
9886  .memberName = "userWriteMask",
9887 #endif
9888  .namespaceZero = true,
9889  .padding = offsetof(UA_VariableTypeAttributes, userWriteMask) - offsetof(UA_VariableTypeAttributes, writeMask) - sizeof(UA_UInt32),
9890  .isArray = false
9891  },
9892  { .memberTypeIndex = UA_TYPES_VARIANT,
9893 #ifdef UA_ENABLE_TYPENAMES
9894  .memberName = "value",
9895 #endif
9896  .namespaceZero = true,
9897  .padding = offsetof(UA_VariableTypeAttributes, value) - offsetof(UA_VariableTypeAttributes, userWriteMask) - sizeof(UA_UInt32),
9898  .isArray = false
9899  },
9900  { .memberTypeIndex = UA_TYPES_NODEID,
9901 #ifdef UA_ENABLE_TYPENAMES
9902  .memberName = "dataType",
9903 #endif
9904  .namespaceZero = true,
9905  .padding = offsetof(UA_VariableTypeAttributes, dataType) - offsetof(UA_VariableTypeAttributes, value) - sizeof(UA_Variant),
9906  .isArray = false
9907  },
9908  { .memberTypeIndex = UA_TYPES_INT32,
9909 #ifdef UA_ENABLE_TYPENAMES
9910  .memberName = "valueRank",
9911 #endif
9912  .namespaceZero = true,
9913  .padding = offsetof(UA_VariableTypeAttributes, valueRank) - offsetof(UA_VariableTypeAttributes, dataType) - sizeof(UA_NodeId),
9914  .isArray = false
9915  },
9916  { .memberTypeIndex = UA_TYPES_UINT32,
9917 #ifdef UA_ENABLE_TYPENAMES
9918  .memberName = "arrayDimensions",
9919 #endif
9920  .namespaceZero = true,
9921  .padding = offsetof(UA_VariableTypeAttributes, arrayDimensionsSize) - offsetof(UA_VariableTypeAttributes, valueRank) - sizeof(UA_Int32),
9922  .isArray = true
9923  },
9924  { .memberTypeIndex = UA_TYPES_BOOLEAN,
9925 #ifdef UA_ENABLE_TYPENAMES
9926  .memberName = "isAbstract",
9927 #endif
9928  .namespaceZero = true,
9929  .padding = offsetof(UA_VariableTypeAttributes, isAbstract) - offsetof(UA_VariableTypeAttributes, arrayDimensions) - sizeof(void*),
9930  .isArray = false
9931  },};
9932 
9933 /* BrowsePathResult */
9934 static UA_DataTypeMember BrowsePathResult_members[2] = {
9936 #ifdef UA_ENABLE_TYPENAMES
9937  .memberName = "statusCode",
9938 #endif
9939  .namespaceZero = true,
9940  .padding = 0,
9941  .isArray = false
9942  },
9943  { .memberTypeIndex = UA_TYPES_BROWSEPATHTARGET,
9944 #ifdef UA_ENABLE_TYPENAMES
9945  .memberName = "targets",
9946 #endif
9947  .namespaceZero = true,
9948  .padding = offsetof(UA_BrowsePathResult, targetsSize) - offsetof(UA_BrowsePathResult, statusCode) - sizeof(UA_StatusCode),
9949  .isArray = true
9950  },};
9951 
9952 /* ModifySubscriptionResponse */
9953 static UA_DataTypeMember ModifySubscriptionResponse_members[4] = {
9955 #ifdef UA_ENABLE_TYPENAMES
9956  .memberName = "responseHeader",
9957 #endif
9958  .namespaceZero = true,
9959  .padding = 0,
9960  .isArray = false
9961  },
9962  { .memberTypeIndex = UA_TYPES_DOUBLE,
9963 #ifdef UA_ENABLE_TYPENAMES
9964  .memberName = "revisedPublishingInterval",
9965 #endif
9966  .namespaceZero = true,
9967  .padding = offsetof(UA_ModifySubscriptionResponse, revisedPublishingInterval) - offsetof(UA_ModifySubscriptionResponse, responseHeader) - sizeof(UA_ResponseHeader),
9968  .isArray = false
9969  },
9970  { .memberTypeIndex = UA_TYPES_UINT32,
9971 #ifdef UA_ENABLE_TYPENAMES
9972  .memberName = "revisedLifetimeCount",
9973 #endif
9974  .namespaceZero = true,
9975  .padding = offsetof(UA_ModifySubscriptionResponse, revisedLifetimeCount) - offsetof(UA_ModifySubscriptionResponse, revisedPublishingInterval) - sizeof(UA_Double),
9976  .isArray = false
9977  },
9978  { .memberTypeIndex = UA_TYPES_UINT32,
9979 #ifdef UA_ENABLE_TYPENAMES
9980  .memberName = "revisedMaxKeepAliveCount",
9981 #endif
9982  .namespaceZero = true,
9983  .padding = offsetof(UA_ModifySubscriptionResponse, revisedMaxKeepAliveCount) - offsetof(UA_ModifySubscriptionResponse, revisedLifetimeCount) - sizeof(UA_UInt32),
9984  .isArray = false
9985  },};
9986 
9987 /* OpenSecureChannelRequest */
9988 static UA_DataTypeMember OpenSecureChannelRequest_members[6] = {
9990 #ifdef UA_ENABLE_TYPENAMES
9991  .memberName = "requestHeader",
9992 #endif
9993  .namespaceZero = true,
9994  .padding = 0,
9995  .isArray = false
9996  },
9997  { .memberTypeIndex = UA_TYPES_UINT32,
9998 #ifdef UA_ENABLE_TYPENAMES
9999  .memberName = "clientProtocolVersion",
10000 #endif
10001  .namespaceZero = true,
10002  .padding = offsetof(UA_OpenSecureChannelRequest, clientProtocolVersion) - offsetof(UA_OpenSecureChannelRequest, requestHeader) - sizeof(UA_RequestHeader),
10003  .isArray = false
10004  },
10005  { .memberTypeIndex = UA_TYPES_SECURITYTOKENREQUESTTYPE,
10006 #ifdef UA_ENABLE_TYPENAMES
10007  .memberName = "requestType",
10008 #endif
10009  .namespaceZero = true,
10010  .padding = offsetof(UA_OpenSecureChannelRequest, requestType) - offsetof(UA_OpenSecureChannelRequest, clientProtocolVersion) - sizeof(UA_UInt32),
10011  .isArray = false
10012  },
10013  { .memberTypeIndex = UA_TYPES_MESSAGESECURITYMODE,
10014 #ifdef UA_ENABLE_TYPENAMES
10015  .memberName = "securityMode",
10016 #endif
10017  .namespaceZero = true,
10018  .padding = offsetof(UA_OpenSecureChannelRequest, securityMode) - offsetof(UA_OpenSecureChannelRequest, requestType) - sizeof(UA_SecurityTokenRequestType),
10019  .isArray = false
10020  },
10021  { .memberTypeIndex = UA_TYPES_BYTESTRING,
10022 #ifdef UA_ENABLE_TYPENAMES
10023  .memberName = "clientNonce",
10024 #endif
10025  .namespaceZero = true,
10026  .padding = offsetof(UA_OpenSecureChannelRequest, clientNonce) - offsetof(UA_OpenSecureChannelRequest, securityMode) - sizeof(UA_MessageSecurityMode),
10027  .isArray = false
10028  },
10029  { .memberTypeIndex = UA_TYPES_UINT32,
10030 #ifdef UA_ENABLE_TYPENAMES
10031  .memberName = "requestedLifetime",
10032 #endif
10033  .namespaceZero = true,
10034  .padding = offsetof(UA_OpenSecureChannelRequest, requestedLifetime) - offsetof(UA_OpenSecureChannelRequest, clientNonce) - sizeof(UA_ByteString),
10035  .isArray = false
10036  },};
10037 
10038 /* RegisterNodesResponse */
10039 static UA_DataTypeMember RegisterNodesResponse_members[2] = {
10041 #ifdef UA_ENABLE_TYPENAMES
10042  .memberName = "responseHeader",
10043 #endif
10044  .namespaceZero = true,
10045  .padding = 0,
10046  .isArray = false
10047  },
10048  { .memberTypeIndex = UA_TYPES_NODEID,
10049 #ifdef UA_ENABLE_TYPENAMES
10050  .memberName = "registeredNodeIds",
10051 #endif
10052  .namespaceZero = true,
10053  .padding = offsetof(UA_RegisterNodesResponse, registeredNodeIdsSize) - offsetof(UA_RegisterNodesResponse, responseHeader) - sizeof(UA_ResponseHeader),
10054  .isArray = true
10055  },};
10056 
10057 /* CloseSessionRequest */
10058 static UA_DataTypeMember CloseSessionRequest_members[2] = {
10060 #ifdef UA_ENABLE_TYPENAMES
10061  .memberName = "requestHeader",
10062 #endif
10063  .namespaceZero = true,
10064  .padding = 0,
10065  .isArray = false
10066  },
10067  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10068 #ifdef UA_ENABLE_TYPENAMES
10069  .memberName = "deleteSubscriptions",
10070 #endif
10071  .namespaceZero = true,
10072  .padding = offsetof(UA_CloseSessionRequest, deleteSubscriptions) - offsetof(UA_CloseSessionRequest, requestHeader) - sizeof(UA_RequestHeader),
10073  .isArray = false
10074  },};
10075 
10076 /* ModifySubscriptionRequest */
10077 static UA_DataTypeMember ModifySubscriptionRequest_members[7] = {
10079 #ifdef UA_ENABLE_TYPENAMES
10080  .memberName = "requestHeader",
10081 #endif
10082  .namespaceZero = true,
10083  .padding = 0,
10084  .isArray = false
10085  },
10086  { .memberTypeIndex = UA_TYPES_UINT32,
10087 #ifdef UA_ENABLE_TYPENAMES
10088  .memberName = "subscriptionId",
10089 #endif
10090  .namespaceZero = true,
10091  .padding = offsetof(UA_ModifySubscriptionRequest, subscriptionId) - offsetof(UA_ModifySubscriptionRequest, requestHeader) - sizeof(UA_RequestHeader),
10092  .isArray = false
10093  },
10094  { .memberTypeIndex = UA_TYPES_DOUBLE,
10095 #ifdef UA_ENABLE_TYPENAMES
10096  .memberName = "requestedPublishingInterval",
10097 #endif
10098  .namespaceZero = true,
10099  .padding = offsetof(UA_ModifySubscriptionRequest, requestedPublishingInterval) - offsetof(UA_ModifySubscriptionRequest, subscriptionId) - sizeof(UA_UInt32),
10100  .isArray = false
10101  },
10102  { .memberTypeIndex = UA_TYPES_UINT32,
10103 #ifdef UA_ENABLE_TYPENAMES
10104  .memberName = "requestedLifetimeCount",
10105 #endif
10106  .namespaceZero = true,
10107  .padding = offsetof(UA_ModifySubscriptionRequest, requestedLifetimeCount) - offsetof(UA_ModifySubscriptionRequest, requestedPublishingInterval) - sizeof(UA_Double),
10108  .isArray = false
10109  },
10110  { .memberTypeIndex = UA_TYPES_UINT32,
10111 #ifdef UA_ENABLE_TYPENAMES
10112  .memberName = "requestedMaxKeepAliveCount",
10113 #endif
10114  .namespaceZero = true,
10115  .padding = offsetof(UA_ModifySubscriptionRequest, requestedMaxKeepAliveCount) - offsetof(UA_ModifySubscriptionRequest, requestedLifetimeCount) - sizeof(UA_UInt32),
10116  .isArray = false
10117  },
10118  { .memberTypeIndex = UA_TYPES_UINT32,
10119 #ifdef UA_ENABLE_TYPENAMES
10120  .memberName = "maxNotificationsPerPublish",
10121 #endif
10122  .namespaceZero = true,
10123  .padding = offsetof(UA_ModifySubscriptionRequest, maxNotificationsPerPublish) - offsetof(UA_ModifySubscriptionRequest, requestedMaxKeepAliveCount) - sizeof(UA_UInt32),
10124  .isArray = false
10125  },
10126  { .memberTypeIndex = UA_TYPES_BYTE,
10127 #ifdef UA_ENABLE_TYPENAMES
10128  .memberName = "priority",
10129 #endif
10130  .namespaceZero = true,
10131  .padding = offsetof(UA_ModifySubscriptionRequest, priority) - offsetof(UA_ModifySubscriptionRequest, maxNotificationsPerPublish) - sizeof(UA_UInt32),
10132  .isArray = false
10133  },};
10134 
10135 /* UserTokenPolicy */
10136 static UA_DataTypeMember UserTokenPolicy_members[5] = {
10138 #ifdef UA_ENABLE_TYPENAMES
10139  .memberName = "policyId",
10140 #endif
10141  .namespaceZero = true,
10142  .padding = 0,
10143  .isArray = false
10144  },
10145  { .memberTypeIndex = UA_TYPES_USERTOKENTYPE,
10146 #ifdef UA_ENABLE_TYPENAMES
10147  .memberName = "tokenType",
10148 #endif
10149  .namespaceZero = true,
10150  .padding = offsetof(UA_UserTokenPolicy, tokenType) - offsetof(UA_UserTokenPolicy, policyId) - sizeof(UA_String),
10151  .isArray = false
10152  },
10153  { .memberTypeIndex = UA_TYPES_STRING,
10154 #ifdef UA_ENABLE_TYPENAMES
10155  .memberName = "issuedTokenType",
10156 #endif
10157  .namespaceZero = true,
10158  .padding = offsetof(UA_UserTokenPolicy, issuedTokenType) - offsetof(UA_UserTokenPolicy, tokenType) - sizeof(UA_UserTokenType),
10159  .isArray = false
10160  },
10161  { .memberTypeIndex = UA_TYPES_STRING,
10162 #ifdef UA_ENABLE_TYPENAMES
10163  .memberName = "issuerEndpointUrl",
10164 #endif
10165  .namespaceZero = true,
10166  .padding = offsetof(UA_UserTokenPolicy, issuerEndpointUrl) - offsetof(UA_UserTokenPolicy, issuedTokenType) - sizeof(UA_String),
10167  .isArray = false
10168  },
10169  { .memberTypeIndex = UA_TYPES_STRING,
10170 #ifdef UA_ENABLE_TYPENAMES
10171  .memberName = "securityPolicyUri",
10172 #endif
10173  .namespaceZero = true,
10174  .padding = offsetof(UA_UserTokenPolicy, securityPolicyUri) - offsetof(UA_UserTokenPolicy, issuerEndpointUrl) - sizeof(UA_String),
10175  .isArray = false
10176  },};
10177 
10178 /* DeleteMonitoredItemsRequest */
10179 static UA_DataTypeMember DeleteMonitoredItemsRequest_members[3] = {
10181 #ifdef UA_ENABLE_TYPENAMES
10182  .memberName = "requestHeader",
10183 #endif
10184  .namespaceZero = true,
10185  .padding = 0,
10186  .isArray = false
10187  },
10188  { .memberTypeIndex = UA_TYPES_UINT32,
10189 #ifdef UA_ENABLE_TYPENAMES
10190  .memberName = "subscriptionId",
10191 #endif
10192  .namespaceZero = true,
10193  .padding = offsetof(UA_DeleteMonitoredItemsRequest, subscriptionId) - offsetof(UA_DeleteMonitoredItemsRequest, requestHeader) - sizeof(UA_RequestHeader),
10194  .isArray = false
10195  },
10196  { .memberTypeIndex = UA_TYPES_UINT32,
10197 #ifdef UA_ENABLE_TYPENAMES
10198  .memberName = "monitoredItemIds",
10199 #endif
10200  .namespaceZero = true,
10201  .padding = offsetof(UA_DeleteMonitoredItemsRequest, monitoredItemIdsSize) - offsetof(UA_DeleteMonitoredItemsRequest, subscriptionId) - sizeof(UA_UInt32),
10202  .isArray = true
10203  },};
10204 
10205 /* ReferenceTypeAttributes */
10206 static UA_DataTypeMember ReferenceTypeAttributes_members[8] = {
10208 #ifdef UA_ENABLE_TYPENAMES
10209  .memberName = "specifiedAttributes",
10210 #endif
10211  .namespaceZero = true,
10212  .padding = 0,
10213  .isArray = false
10214  },
10215  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10216 #ifdef UA_ENABLE_TYPENAMES
10217  .memberName = "displayName",
10218 #endif
10219  .namespaceZero = true,
10220  .padding = offsetof(UA_ReferenceTypeAttributes, displayName) - offsetof(UA_ReferenceTypeAttributes, specifiedAttributes) - sizeof(UA_UInt32),
10221  .isArray = false
10222  },
10223  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10224 #ifdef UA_ENABLE_TYPENAMES
10225  .memberName = "description",
10226 #endif
10227  .namespaceZero = true,
10228  .padding = offsetof(UA_ReferenceTypeAttributes, description) - offsetof(UA_ReferenceTypeAttributes, displayName) - sizeof(UA_LocalizedText),
10229  .isArray = false
10230  },
10231  { .memberTypeIndex = UA_TYPES_UINT32,
10232 #ifdef UA_ENABLE_TYPENAMES
10233  .memberName = "writeMask",
10234 #endif
10235  .namespaceZero = true,
10236  .padding = offsetof(UA_ReferenceTypeAttributes, writeMask) - offsetof(UA_ReferenceTypeAttributes, description) - sizeof(UA_LocalizedText),
10237  .isArray = false
10238  },
10239  { .memberTypeIndex = UA_TYPES_UINT32,
10240 #ifdef UA_ENABLE_TYPENAMES
10241  .memberName = "userWriteMask",
10242 #endif
10243  .namespaceZero = true,
10244  .padding = offsetof(UA_ReferenceTypeAttributes, userWriteMask) - offsetof(UA_ReferenceTypeAttributes, writeMask) - sizeof(UA_UInt32),
10245  .isArray = false
10246  },
10247  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10248 #ifdef UA_ENABLE_TYPENAMES
10249  .memberName = "isAbstract",
10250 #endif
10251  .namespaceZero = true,
10252  .padding = offsetof(UA_ReferenceTypeAttributes, isAbstract) - offsetof(UA_ReferenceTypeAttributes, userWriteMask) - sizeof(UA_UInt32),
10253  .isArray = false
10254  },
10255  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10256 #ifdef UA_ENABLE_TYPENAMES
10257  .memberName = "symmetric",
10258 #endif
10259  .namespaceZero = true,
10260  .padding = offsetof(UA_ReferenceTypeAttributes, symmetric) - offsetof(UA_ReferenceTypeAttributes, isAbstract) - sizeof(UA_Boolean),
10261  .isArray = false
10262  },
10263  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10264 #ifdef UA_ENABLE_TYPENAMES
10265  .memberName = "inverseName",
10266 #endif
10267  .namespaceZero = true,
10268  .padding = offsetof(UA_ReferenceTypeAttributes, inverseName) - offsetof(UA_ReferenceTypeAttributes, symmetric) - sizeof(UA_Boolean),
10269  .isArray = false
10270  },};
10271 
10272 /* SetMonitoringModeRequest */
10273 static UA_DataTypeMember SetMonitoringModeRequest_members[4] = {
10275 #ifdef UA_ENABLE_TYPENAMES
10276  .memberName = "requestHeader",
10277 #endif
10278  .namespaceZero = true,
10279  .padding = 0,
10280  .isArray = false
10281  },
10282  { .memberTypeIndex = UA_TYPES_UINT32,
10283 #ifdef UA_ENABLE_TYPENAMES
10284  .memberName = "subscriptionId",
10285 #endif
10286  .namespaceZero = true,
10287  .padding = offsetof(UA_SetMonitoringModeRequest, subscriptionId) - offsetof(UA_SetMonitoringModeRequest, requestHeader) - sizeof(UA_RequestHeader),
10288  .isArray = false
10289  },
10290  { .memberTypeIndex = UA_TYPES_MONITORINGMODE,
10291 #ifdef UA_ENABLE_TYPENAMES
10292  .memberName = "monitoringMode",
10293 #endif
10294  .namespaceZero = true,
10295  .padding = offsetof(UA_SetMonitoringModeRequest, monitoringMode) - offsetof(UA_SetMonitoringModeRequest, subscriptionId) - sizeof(UA_UInt32),
10296  .isArray = false
10297  },
10298  { .memberTypeIndex = UA_TYPES_UINT32,
10299 #ifdef UA_ENABLE_TYPENAMES
10300  .memberName = "monitoredItemIds",
10301 #endif
10302  .namespaceZero = true,
10303  .padding = offsetof(UA_SetMonitoringModeRequest, monitoredItemIdsSize) - offsetof(UA_SetMonitoringModeRequest, monitoringMode) - sizeof(UA_MonitoringMode),
10304  .isArray = true
10305  },};
10306 
10307 /* UnregisterNodesResponse */
10308 static UA_DataTypeMember UnregisterNodesResponse_members[1] = {
10310 #ifdef UA_ENABLE_TYPENAMES
10311  .memberName = "responseHeader",
10312 #endif
10313  .namespaceZero = true,
10314  .padding = 0,
10315  .isArray = false
10316  },};
10317 
10318 /* WriteRequest */
10319 static UA_DataTypeMember WriteRequest_members[2] = {
10321 #ifdef UA_ENABLE_TYPENAMES
10322  .memberName = "requestHeader",
10323 #endif
10324  .namespaceZero = true,
10325  .padding = 0,
10326  .isArray = false
10327  },
10328  { .memberTypeIndex = UA_TYPES_WRITEVALUE,
10329 #ifdef UA_ENABLE_TYPENAMES
10330  .memberName = "nodesToWrite",
10331 #endif
10332  .namespaceZero = true,
10333  .padding = offsetof(UA_WriteRequest, nodesToWriteSize) - offsetof(UA_WriteRequest, requestHeader) - sizeof(UA_RequestHeader),
10334  .isArray = true
10335  },};
10336 
10337 /* ObjectAttributes */
10338 static UA_DataTypeMember ObjectAttributes_members[6] = {
10340 #ifdef UA_ENABLE_TYPENAMES
10341  .memberName = "specifiedAttributes",
10342 #endif
10343  .namespaceZero = true,
10344  .padding = 0,
10345  .isArray = false
10346  },
10347  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10348 #ifdef UA_ENABLE_TYPENAMES
10349  .memberName = "displayName",
10350 #endif
10351  .namespaceZero = true,
10352  .padding = offsetof(UA_ObjectAttributes, displayName) - offsetof(UA_ObjectAttributes, specifiedAttributes) - sizeof(UA_UInt32),
10353  .isArray = false
10354  },
10355  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10356 #ifdef UA_ENABLE_TYPENAMES
10357  .memberName = "description",
10358 #endif
10359  .namespaceZero = true,
10360  .padding = offsetof(UA_ObjectAttributes, description) - offsetof(UA_ObjectAttributes, displayName) - sizeof(UA_LocalizedText),
10361  .isArray = false
10362  },
10363  { .memberTypeIndex = UA_TYPES_UINT32,
10364 #ifdef UA_ENABLE_TYPENAMES
10365  .memberName = "writeMask",
10366 #endif
10367  .namespaceZero = true,
10368  .padding = offsetof(UA_ObjectAttributes, writeMask) - offsetof(UA_ObjectAttributes, description) - sizeof(UA_LocalizedText),
10369  .isArray = false
10370  },
10371  { .memberTypeIndex = UA_TYPES_UINT32,
10372 #ifdef UA_ENABLE_TYPENAMES
10373  .memberName = "userWriteMask",
10374 #endif
10375  .namespaceZero = true,
10376  .padding = offsetof(UA_ObjectAttributes, userWriteMask) - offsetof(UA_ObjectAttributes, writeMask) - sizeof(UA_UInt32),
10377  .isArray = false
10378  },
10379  { .memberTypeIndex = UA_TYPES_BYTE,
10380 #ifdef UA_ENABLE_TYPENAMES
10381  .memberName = "eventNotifier",
10382 #endif
10383  .namespaceZero = true,
10384  .padding = offsetof(UA_ObjectAttributes, eventNotifier) - offsetof(UA_ObjectAttributes, userWriteMask) - sizeof(UA_UInt32),
10385  .isArray = false
10386  },};
10387 
10388 /* BrowseDescription */
10389 static UA_DataTypeMember BrowseDescription_members[6] = {
10391 #ifdef UA_ENABLE_TYPENAMES
10392  .memberName = "nodeId",
10393 #endif
10394  .namespaceZero = true,
10395  .padding = 0,
10396  .isArray = false
10397  },
10398  { .memberTypeIndex = UA_TYPES_BROWSEDIRECTION,
10399 #ifdef UA_ENABLE_TYPENAMES
10400  .memberName = "browseDirection",
10401 #endif
10402  .namespaceZero = true,
10403  .padding = offsetof(UA_BrowseDescription, browseDirection) - offsetof(UA_BrowseDescription, nodeId) - sizeof(UA_NodeId),
10404  .isArray = false
10405  },
10406  { .memberTypeIndex = UA_TYPES_NODEID,
10407 #ifdef UA_ENABLE_TYPENAMES
10408  .memberName = "referenceTypeId",
10409 #endif
10410  .namespaceZero = true,
10411  .padding = offsetof(UA_BrowseDescription, referenceTypeId) - offsetof(UA_BrowseDescription, browseDirection) - sizeof(UA_BrowseDirection),
10412  .isArray = false
10413  },
10414  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10415 #ifdef UA_ENABLE_TYPENAMES
10416  .memberName = "includeSubtypes",
10417 #endif
10418  .namespaceZero = true,
10419  .padding = offsetof(UA_BrowseDescription, includeSubtypes) - offsetof(UA_BrowseDescription, referenceTypeId) - sizeof(UA_NodeId),
10420  .isArray = false
10421  },
10422  { .memberTypeIndex = UA_TYPES_UINT32,
10423 #ifdef UA_ENABLE_TYPENAMES
10424  .memberName = "nodeClassMask",
10425 #endif
10426  .namespaceZero = true,
10427  .padding = offsetof(UA_BrowseDescription, nodeClassMask) - offsetof(UA_BrowseDescription, includeSubtypes) - sizeof(UA_Boolean),
10428  .isArray = false
10429  },
10430  { .memberTypeIndex = UA_TYPES_UINT32,
10431 #ifdef UA_ENABLE_TYPENAMES
10432  .memberName = "resultMask",
10433 #endif
10434  .namespaceZero = true,
10435  .padding = offsetof(UA_BrowseDescription, resultMask) - offsetof(UA_BrowseDescription, nodeClassMask) - sizeof(UA_UInt32),
10436  .isArray = false
10437  },};
10438 
10439 /* RepublishRequest */
10440 static UA_DataTypeMember RepublishRequest_members[3] = {
10442 #ifdef UA_ENABLE_TYPENAMES
10443  .memberName = "requestHeader",
10444 #endif
10445  .namespaceZero = true,
10446  .padding = 0,
10447  .isArray = false
10448  },
10449  { .memberTypeIndex = UA_TYPES_UINT32,
10450 #ifdef UA_ENABLE_TYPENAMES
10451  .memberName = "subscriptionId",
10452 #endif
10453  .namespaceZero = true,
10454  .padding = offsetof(UA_RepublishRequest, subscriptionId) - offsetof(UA_RepublishRequest, requestHeader) - sizeof(UA_RequestHeader),
10455  .isArray = false
10456  },
10457  { .memberTypeIndex = UA_TYPES_UINT32,
10458 #ifdef UA_ENABLE_TYPENAMES
10459  .memberName = "retransmitSequenceNumber",
10460 #endif
10461  .namespaceZero = true,
10462  .padding = offsetof(UA_RepublishRequest, retransmitSequenceNumber) - offsetof(UA_RepublishRequest, subscriptionId) - sizeof(UA_UInt32),
10463  .isArray = false
10464  },};
10465 
10466 /* GetEndpointsRequest */
10467 static UA_DataTypeMember GetEndpointsRequest_members[4] = {
10469 #ifdef UA_ENABLE_TYPENAMES
10470  .memberName = "requestHeader",
10471 #endif
10472  .namespaceZero = true,
10473  .padding = 0,
10474  .isArray = false
10475  },
10476  { .memberTypeIndex = UA_TYPES_STRING,
10477 #ifdef UA_ENABLE_TYPENAMES
10478  .memberName = "endpointUrl",
10479 #endif
10480  .namespaceZero = true,
10481  .padding = offsetof(UA_GetEndpointsRequest, endpointUrl) - offsetof(UA_GetEndpointsRequest, requestHeader) - sizeof(UA_RequestHeader),
10482  .isArray = false
10483  },
10484  { .memberTypeIndex = UA_TYPES_STRING,
10485 #ifdef UA_ENABLE_TYPENAMES
10486  .memberName = "localeIds",
10487 #endif
10488  .namespaceZero = true,
10489  .padding = offsetof(UA_GetEndpointsRequest, localeIdsSize) - offsetof(UA_GetEndpointsRequest, endpointUrl) - sizeof(UA_String),
10490  .isArray = true
10491  },
10492  { .memberTypeIndex = UA_TYPES_STRING,
10493 #ifdef UA_ENABLE_TYPENAMES
10494  .memberName = "profileUris",
10495 #endif
10496  .namespaceZero = true,
10497  .padding = offsetof(UA_GetEndpointsRequest, profileUrisSize) - offsetof(UA_GetEndpointsRequest, localeIds) - sizeof(void*),
10498  .isArray = true
10499  },};
10500 
10501 /* PublishRequest */
10502 static UA_DataTypeMember PublishRequest_members[2] = {
10504 #ifdef UA_ENABLE_TYPENAMES
10505  .memberName = "requestHeader",
10506 #endif
10507  .namespaceZero = true,
10508  .padding = 0,
10509  .isArray = false
10510  },
10511  { .memberTypeIndex = UA_TYPES_SUBSCRIPTIONACKNOWLEDGEMENT,
10512 #ifdef UA_ENABLE_TYPENAMES
10513  .memberName = "subscriptionAcknowledgements",
10514 #endif
10515  .namespaceZero = true,
10516  .padding = offsetof(UA_PublishRequest, subscriptionAcknowledgementsSize) - offsetof(UA_PublishRequest, requestHeader) - sizeof(UA_RequestHeader),
10517  .isArray = true
10518  },};
10519 
10520 /* AddNodesResponse */
10521 static UA_DataTypeMember AddNodesResponse_members[3] = {
10523 #ifdef UA_ENABLE_TYPENAMES
10524  .memberName = "responseHeader",
10525 #endif
10526  .namespaceZero = true,
10527  .padding = 0,
10528  .isArray = false
10529  },
10530  { .memberTypeIndex = UA_TYPES_ADDNODESRESULT,
10531 #ifdef UA_ENABLE_TYPENAMES
10532  .memberName = "results",
10533 #endif
10534  .namespaceZero = true,
10535  .padding = offsetof(UA_AddNodesResponse, resultsSize) - offsetof(UA_AddNodesResponse, responseHeader) - sizeof(UA_ResponseHeader),
10536  .isArray = true
10537  },
10538  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10539 #ifdef UA_ENABLE_TYPENAMES
10540  .memberName = "diagnosticInfos",
10541 #endif
10542  .namespaceZero = true,
10543  .padding = offsetof(UA_AddNodesResponse, diagnosticInfosSize) - offsetof(UA_AddNodesResponse, results) - sizeof(void*),
10544  .isArray = true
10545  },};
10546 
10547 /* DataChangeNotification */
10548 static UA_DataTypeMember DataChangeNotification_members[2] = {
10550 #ifdef UA_ENABLE_TYPENAMES
10551  .memberName = "monitoredItems",
10552 #endif
10553  .namespaceZero = true,
10554  .padding = 0,
10555  .isArray = true
10556  },
10557  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10558 #ifdef UA_ENABLE_TYPENAMES
10559  .memberName = "diagnosticInfos",
10560 #endif
10561  .namespaceZero = true,
10562  .padding = offsetof(UA_DataChangeNotification, diagnosticInfosSize) - offsetof(UA_DataChangeNotification, monitoredItems) - sizeof(void*),
10563  .isArray = true
10564  },};
10565 
10566 /* CloseSecureChannelResponse */
10567 static UA_DataTypeMember CloseSecureChannelResponse_members[1] = {
10569 #ifdef UA_ENABLE_TYPENAMES
10570  .memberName = "responseHeader",
10571 #endif
10572  .namespaceZero = true,
10573  .padding = 0,
10574  .isArray = false
10575  },};
10576 
10577 /* ModifyMonitoredItemsRequest */
10578 static UA_DataTypeMember ModifyMonitoredItemsRequest_members[4] = {
10580 #ifdef UA_ENABLE_TYPENAMES
10581  .memberName = "requestHeader",
10582 #endif
10583  .namespaceZero = true,
10584  .padding = 0,
10585  .isArray = false
10586  },
10587  { .memberTypeIndex = UA_TYPES_UINT32,
10588 #ifdef UA_ENABLE_TYPENAMES
10589  .memberName = "subscriptionId",
10590 #endif
10591  .namespaceZero = true,
10592  .padding = offsetof(UA_ModifyMonitoredItemsRequest, subscriptionId) - offsetof(UA_ModifyMonitoredItemsRequest, requestHeader) - sizeof(UA_RequestHeader),
10593  .isArray = false
10594  },
10595  { .memberTypeIndex = UA_TYPES_TIMESTAMPSTORETURN,
10596 #ifdef UA_ENABLE_TYPENAMES
10597  .memberName = "timestampsToReturn",
10598 #endif
10599  .namespaceZero = true,
10600  .padding = offsetof(UA_ModifyMonitoredItemsRequest, timestampsToReturn) - offsetof(UA_ModifyMonitoredItemsRequest, subscriptionId) - sizeof(UA_UInt32),
10601  .isArray = false
10602  },
10603  { .memberTypeIndex = UA_TYPES_MONITOREDITEMMODIFYREQUEST,
10604 #ifdef UA_ENABLE_TYPENAMES
10605  .memberName = "itemsToModify",
10606 #endif
10607  .namespaceZero = true,
10608  .padding = offsetof(UA_ModifyMonitoredItemsRequest, itemsToModifySize) - offsetof(UA_ModifyMonitoredItemsRequest, timestampsToReturn) - sizeof(UA_TimestampsToReturn),
10609  .isArray = true
10610  },};
10611 
10612 /* SetMonitoringModeResponse */
10613 static UA_DataTypeMember SetMonitoringModeResponse_members[3] = {
10615 #ifdef UA_ENABLE_TYPENAMES
10616  .memberName = "responseHeader",
10617 #endif
10618  .namespaceZero = true,
10619  .padding = 0,
10620  .isArray = false
10621  },
10622  { .memberTypeIndex = UA_TYPES_STATUSCODE,
10623 #ifdef UA_ENABLE_TYPENAMES
10624  .memberName = "results",
10625 #endif
10626  .namespaceZero = true,
10627  .padding = offsetof(UA_SetMonitoringModeResponse, resultsSize) - offsetof(UA_SetMonitoringModeResponse, responseHeader) - sizeof(UA_ResponseHeader),
10628  .isArray = true
10629  },
10630  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10631 #ifdef UA_ENABLE_TYPENAMES
10632  .memberName = "diagnosticInfos",
10633 #endif
10634  .namespaceZero = true,
10635  .padding = offsetof(UA_SetMonitoringModeResponse, diagnosticInfosSize) - offsetof(UA_SetMonitoringModeResponse, results) - sizeof(void*),
10636  .isArray = true
10637  },};
10638 
10639 /* FindServersRequest */
10640 static UA_DataTypeMember FindServersRequest_members[4] = {
10642 #ifdef UA_ENABLE_TYPENAMES
10643  .memberName = "requestHeader",
10644 #endif
10645  .namespaceZero = true,
10646  .padding = 0,
10647  .isArray = false
10648  },
10649  { .memberTypeIndex = UA_TYPES_STRING,
10650 #ifdef UA_ENABLE_TYPENAMES
10651  .memberName = "endpointUrl",
10652 #endif
10653  .namespaceZero = true,
10654  .padding = offsetof(UA_FindServersRequest, endpointUrl) - offsetof(UA_FindServersRequest, requestHeader) - sizeof(UA_RequestHeader),
10655  .isArray = false
10656  },
10657  { .memberTypeIndex = UA_TYPES_STRING,
10658 #ifdef UA_ENABLE_TYPENAMES
10659  .memberName = "localeIds",
10660 #endif
10661  .namespaceZero = true,
10662  .padding = offsetof(UA_FindServersRequest, localeIdsSize) - offsetof(UA_FindServersRequest, endpointUrl) - sizeof(UA_String),
10663  .isArray = true
10664  },
10665  { .memberTypeIndex = UA_TYPES_STRING,
10666 #ifdef UA_ENABLE_TYPENAMES
10667  .memberName = "serverUris",
10668 #endif
10669  .namespaceZero = true,
10670  .padding = offsetof(UA_FindServersRequest, serverUrisSize) - offsetof(UA_FindServersRequest, localeIds) - sizeof(void*),
10671  .isArray = true
10672  },};
10673 
10674 /* ReferenceDescription */
10675 static UA_DataTypeMember ReferenceDescription_members[7] = {
10677 #ifdef UA_ENABLE_TYPENAMES
10678  .memberName = "referenceTypeId",
10679 #endif
10680  .namespaceZero = true,
10681  .padding = 0,
10682  .isArray = false
10683  },
10684  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10685 #ifdef UA_ENABLE_TYPENAMES
10686  .memberName = "isForward",
10687 #endif
10688  .namespaceZero = true,
10689  .padding = offsetof(UA_ReferenceDescription, isForward) - offsetof(UA_ReferenceDescription, referenceTypeId) - sizeof(UA_NodeId),
10690  .isArray = false
10691  },
10692  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
10693 #ifdef UA_ENABLE_TYPENAMES
10694  .memberName = "nodeId",
10695 #endif
10696  .namespaceZero = true,
10697  .padding = offsetof(UA_ReferenceDescription, nodeId) - offsetof(UA_ReferenceDescription, isForward) - sizeof(UA_Boolean),
10698  .isArray = false
10699  },
10700  { .memberTypeIndex = UA_TYPES_QUALIFIEDNAME,
10701 #ifdef UA_ENABLE_TYPENAMES
10702  .memberName = "browseName",
10703 #endif
10704  .namespaceZero = true,
10705  .padding = offsetof(UA_ReferenceDescription, browseName) - offsetof(UA_ReferenceDescription, nodeId) - sizeof(UA_ExpandedNodeId),
10706  .isArray = false
10707  },
10708  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
10709 #ifdef UA_ENABLE_TYPENAMES
10710  .memberName = "displayName",
10711 #endif
10712  .namespaceZero = true,
10713  .padding = offsetof(UA_ReferenceDescription, displayName) - offsetof(UA_ReferenceDescription, browseName) - sizeof(UA_QualifiedName),
10714  .isArray = false
10715  },
10716  { .memberTypeIndex = UA_TYPES_NODECLASS,
10717 #ifdef UA_ENABLE_TYPENAMES
10718  .memberName = "nodeClass",
10719 #endif
10720  .namespaceZero = true,
10721  .padding = offsetof(UA_ReferenceDescription, nodeClass) - offsetof(UA_ReferenceDescription, displayName) - sizeof(UA_LocalizedText),
10722  .isArray = false
10723  },
10724  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
10725 #ifdef UA_ENABLE_TYPENAMES
10726  .memberName = "typeDefinition",
10727 #endif
10728  .namespaceZero = true,
10729  .padding = offsetof(UA_ReferenceDescription, typeDefinition) - offsetof(UA_ReferenceDescription, nodeClass) - sizeof(UA_NodeClass),
10730  .isArray = false
10731  },};
10732 
10733 /* SetPublishingModeResponse */
10734 static UA_DataTypeMember SetPublishingModeResponse_members[3] = {
10736 #ifdef UA_ENABLE_TYPENAMES
10737  .memberName = "responseHeader",
10738 #endif
10739  .namespaceZero = true,
10740  .padding = 0,
10741  .isArray = false
10742  },
10743  { .memberTypeIndex = UA_TYPES_STATUSCODE,
10744 #ifdef UA_ENABLE_TYPENAMES
10745  .memberName = "results",
10746 #endif
10747  .namespaceZero = true,
10748  .padding = offsetof(UA_SetPublishingModeResponse, resultsSize) - offsetof(UA_SetPublishingModeResponse, responseHeader) - sizeof(UA_ResponseHeader),
10749  .isArray = true
10750  },
10751  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10752 #ifdef UA_ENABLE_TYPENAMES
10753  .memberName = "diagnosticInfos",
10754 #endif
10755  .namespaceZero = true,
10756  .padding = offsetof(UA_SetPublishingModeResponse, diagnosticInfosSize) - offsetof(UA_SetPublishingModeResponse, results) - sizeof(void*),
10757  .isArray = true
10758  },};
10759 
10760 /* ContentFilterResult */
10761 static UA_DataTypeMember ContentFilterResult_members[2] = {
10763 #ifdef UA_ENABLE_TYPENAMES
10764  .memberName = "elementResults",
10765 #endif
10766  .namespaceZero = true,
10767  .padding = 0,
10768  .isArray = true
10769  },
10770  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10771 #ifdef UA_ENABLE_TYPENAMES
10772  .memberName = "elementDiagnosticInfos",
10773 #endif
10774  .namespaceZero = true,
10775  .padding = offsetof(UA_ContentFilterResult, elementDiagnosticInfosSize) - offsetof(UA_ContentFilterResult, elementResults) - sizeof(void*),
10776  .isArray = true
10777  },};
10778 
10779 /* AddReferencesItem */
10780 static UA_DataTypeMember AddReferencesItem_members[6] = {
10782 #ifdef UA_ENABLE_TYPENAMES
10783  .memberName = "sourceNodeId",
10784 #endif
10785  .namespaceZero = true,
10786  .padding = 0,
10787  .isArray = false
10788  },
10789  { .memberTypeIndex = UA_TYPES_NODEID,
10790 #ifdef UA_ENABLE_TYPENAMES
10791  .memberName = "referenceTypeId",
10792 #endif
10793  .namespaceZero = true,
10794  .padding = offsetof(UA_AddReferencesItem, referenceTypeId) - offsetof(UA_AddReferencesItem, sourceNodeId) - sizeof(UA_NodeId),
10795  .isArray = false
10796  },
10797  { .memberTypeIndex = UA_TYPES_BOOLEAN,
10798 #ifdef UA_ENABLE_TYPENAMES
10799  .memberName = "isForward",
10800 #endif
10801  .namespaceZero = true,
10802  .padding = offsetof(UA_AddReferencesItem, isForward) - offsetof(UA_AddReferencesItem, referenceTypeId) - sizeof(UA_NodeId),
10803  .isArray = false
10804  },
10805  { .memberTypeIndex = UA_TYPES_STRING,
10806 #ifdef UA_ENABLE_TYPENAMES
10807  .memberName = "targetServerUri",
10808 #endif
10809  .namespaceZero = true,
10810  .padding = offsetof(UA_AddReferencesItem, targetServerUri) - offsetof(UA_AddReferencesItem, isForward) - sizeof(UA_Boolean),
10811  .isArray = false
10812  },
10813  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
10814 #ifdef UA_ENABLE_TYPENAMES
10815  .memberName = "targetNodeId",
10816 #endif
10817  .namespaceZero = true,
10818  .padding = offsetof(UA_AddReferencesItem, targetNodeId) - offsetof(UA_AddReferencesItem, targetServerUri) - sizeof(UA_String),
10819  .isArray = false
10820  },
10821  { .memberTypeIndex = UA_TYPES_NODECLASS,
10822 #ifdef UA_ENABLE_TYPENAMES
10823  .memberName = "targetNodeClass",
10824 #endif
10825  .namespaceZero = true,
10826  .padding = offsetof(UA_AddReferencesItem, targetNodeClass) - offsetof(UA_AddReferencesItem, targetNodeId) - sizeof(UA_ExpandedNodeId),
10827  .isArray = false
10828  },};
10829 
10830 /* CreateSubscriptionResponse */
10831 static UA_DataTypeMember CreateSubscriptionResponse_members[5] = {
10833 #ifdef UA_ENABLE_TYPENAMES
10834  .memberName = "responseHeader",
10835 #endif
10836  .namespaceZero = true,
10837  .padding = 0,
10838  .isArray = false
10839  },
10840  { .memberTypeIndex = UA_TYPES_UINT32,
10841 #ifdef UA_ENABLE_TYPENAMES
10842  .memberName = "subscriptionId",
10843 #endif
10844  .namespaceZero = true,
10845  .padding = offsetof(UA_CreateSubscriptionResponse, subscriptionId) - offsetof(UA_CreateSubscriptionResponse, responseHeader) - sizeof(UA_ResponseHeader),
10846  .isArray = false
10847  },
10848  { .memberTypeIndex = UA_TYPES_DOUBLE,
10849 #ifdef UA_ENABLE_TYPENAMES
10850  .memberName = "revisedPublishingInterval",
10851 #endif
10852  .namespaceZero = true,
10853  .padding = offsetof(UA_CreateSubscriptionResponse, revisedPublishingInterval) - offsetof(UA_CreateSubscriptionResponse, subscriptionId) - sizeof(UA_UInt32),
10854  .isArray = false
10855  },
10856  { .memberTypeIndex = UA_TYPES_UINT32,
10857 #ifdef UA_ENABLE_TYPENAMES
10858  .memberName = "revisedLifetimeCount",
10859 #endif
10860  .namespaceZero = true,
10861  .padding = offsetof(UA_CreateSubscriptionResponse, revisedLifetimeCount) - offsetof(UA_CreateSubscriptionResponse, revisedPublishingInterval) - sizeof(UA_Double),
10862  .isArray = false
10863  },
10864  { .memberTypeIndex = UA_TYPES_UINT32,
10865 #ifdef UA_ENABLE_TYPENAMES
10866  .memberName = "revisedMaxKeepAliveCount",
10867 #endif
10868  .namespaceZero = true,
10869  .padding = offsetof(UA_CreateSubscriptionResponse, revisedMaxKeepAliveCount) - offsetof(UA_CreateSubscriptionResponse, revisedLifetimeCount) - sizeof(UA_UInt32),
10870  .isArray = false
10871  },};
10872 
10873 /* DeleteSubscriptionsResponse */
10874 static UA_DataTypeMember DeleteSubscriptionsResponse_members[3] = {
10876 #ifdef UA_ENABLE_TYPENAMES
10877  .memberName = "responseHeader",
10878 #endif
10879  .namespaceZero = true,
10880  .padding = 0,
10881  .isArray = false
10882  },
10883  { .memberTypeIndex = UA_TYPES_STATUSCODE,
10884 #ifdef UA_ENABLE_TYPENAMES
10885  .memberName = "results",
10886 #endif
10887  .namespaceZero = true,
10888  .padding = offsetof(UA_DeleteSubscriptionsResponse, resultsSize) - offsetof(UA_DeleteSubscriptionsResponse, responseHeader) - sizeof(UA_ResponseHeader),
10889  .isArray = true
10890  },
10891  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10892 #ifdef UA_ENABLE_TYPENAMES
10893  .memberName = "diagnosticInfos",
10894 #endif
10895  .namespaceZero = true,
10896  .padding = offsetof(UA_DeleteSubscriptionsResponse, diagnosticInfosSize) - offsetof(UA_DeleteSubscriptionsResponse, results) - sizeof(void*),
10897  .isArray = true
10898  },};
10899 
10900 /* RelativePath */
10901 static UA_DataTypeMember RelativePath_members[1] = {
10903 #ifdef UA_ENABLE_TYPENAMES
10904  .memberName = "elements",
10905 #endif
10906  .namespaceZero = true,
10907  .padding = 0,
10908  .isArray = true
10909  },};
10910 
10911 /* DeleteReferencesResponse */
10912 static UA_DataTypeMember DeleteReferencesResponse_members[3] = {
10914 #ifdef UA_ENABLE_TYPENAMES
10915  .memberName = "responseHeader",
10916 #endif
10917  .namespaceZero = true,
10918  .padding = 0,
10919  .isArray = false
10920  },
10921  { .memberTypeIndex = UA_TYPES_STATUSCODE,
10922 #ifdef UA_ENABLE_TYPENAMES
10923  .memberName = "results",
10924 #endif
10925  .namespaceZero = true,
10926  .padding = offsetof(UA_DeleteReferencesResponse, resultsSize) - offsetof(UA_DeleteReferencesResponse, responseHeader) - sizeof(UA_ResponseHeader),
10927  .isArray = true
10928  },
10929  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10930 #ifdef UA_ENABLE_TYPENAMES
10931  .memberName = "diagnosticInfos",
10932 #endif
10933  .namespaceZero = true,
10934  .padding = offsetof(UA_DeleteReferencesResponse, diagnosticInfosSize) - offsetof(UA_DeleteReferencesResponse, results) - sizeof(void*),
10935  .isArray = true
10936  },};
10937 
10938 /* CreateMonitoredItemsResponse */
10939 static UA_DataTypeMember CreateMonitoredItemsResponse_members[3] = {
10941 #ifdef UA_ENABLE_TYPENAMES
10942  .memberName = "responseHeader",
10943 #endif
10944  .namespaceZero = true,
10945  .padding = 0,
10946  .isArray = false
10947  },
10948  { .memberTypeIndex = UA_TYPES_MONITOREDITEMCREATERESULT,
10949 #ifdef UA_ENABLE_TYPENAMES
10950  .memberName = "results",
10951 #endif
10952  .namespaceZero = true,
10953  .padding = offsetof(UA_CreateMonitoredItemsResponse, resultsSize) - offsetof(UA_CreateMonitoredItemsResponse, responseHeader) - sizeof(UA_ResponseHeader),
10954  .isArray = true
10955  },
10956  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10957 #ifdef UA_ENABLE_TYPENAMES
10958  .memberName = "diagnosticInfos",
10959 #endif
10960  .namespaceZero = true,
10961  .padding = offsetof(UA_CreateMonitoredItemsResponse, diagnosticInfosSize) - offsetof(UA_CreateMonitoredItemsResponse, results) - sizeof(void*),
10962  .isArray = true
10963  },};
10964 
10965 /* CallResponse */
10966 static UA_DataTypeMember CallResponse_members[3] = {
10968 #ifdef UA_ENABLE_TYPENAMES
10969  .memberName = "responseHeader",
10970 #endif
10971  .namespaceZero = true,
10972  .padding = 0,
10973  .isArray = false
10974  },
10975  { .memberTypeIndex = UA_TYPES_CALLMETHODRESULT,
10976 #ifdef UA_ENABLE_TYPENAMES
10977  .memberName = "results",
10978 #endif
10979  .namespaceZero = true,
10980  .padding = offsetof(UA_CallResponse, resultsSize) - offsetof(UA_CallResponse, responseHeader) - sizeof(UA_ResponseHeader),
10981  .isArray = true
10982  },
10983  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
10984 #ifdef UA_ENABLE_TYPENAMES
10985  .memberName = "diagnosticInfos",
10986 #endif
10987  .namespaceZero = true,
10988  .padding = offsetof(UA_CallResponse, diagnosticInfosSize) - offsetof(UA_CallResponse, results) - sizeof(void*),
10989  .isArray = true
10990  },};
10991 
10992 /* DeleteNodesResponse */
10993 static UA_DataTypeMember DeleteNodesResponse_members[3] = {
10995 #ifdef UA_ENABLE_TYPENAMES
10996  .memberName = "responseHeader",
10997 #endif
10998  .namespaceZero = true,
10999  .padding = 0,
11000  .isArray = false
11001  },
11002  { .memberTypeIndex = UA_TYPES_STATUSCODE,
11003 #ifdef UA_ENABLE_TYPENAMES
11004  .memberName = "results",
11005 #endif
11006  .namespaceZero = true,
11007  .padding = offsetof(UA_DeleteNodesResponse, resultsSize) - offsetof(UA_DeleteNodesResponse, responseHeader) - sizeof(UA_ResponseHeader),
11008  .isArray = true
11009  },
11010  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11011 #ifdef UA_ENABLE_TYPENAMES
11012  .memberName = "diagnosticInfos",
11013 #endif
11014  .namespaceZero = true,
11015  .padding = offsetof(UA_DeleteNodesResponse, diagnosticInfosSize) - offsetof(UA_DeleteNodesResponse, results) - sizeof(void*),
11016  .isArray = true
11017  },};
11018 
11019 /* RepublishResponse */
11020 static UA_DataTypeMember RepublishResponse_members[2] = {
11022 #ifdef UA_ENABLE_TYPENAMES
11023  .memberName = "responseHeader",
11024 #endif
11025  .namespaceZero = true,
11026  .padding = 0,
11027  .isArray = false
11028  },
11029  { .memberTypeIndex = UA_TYPES_NOTIFICATIONMESSAGE,
11030 #ifdef UA_ENABLE_TYPENAMES
11031  .memberName = "notificationMessage",
11032 #endif
11033  .namespaceZero = true,
11034  .padding = offsetof(UA_RepublishResponse, notificationMessage) - offsetof(UA_RepublishResponse, responseHeader) - sizeof(UA_ResponseHeader),
11035  .isArray = false
11036  },};
11037 
11038 /* MonitoredItemCreateRequest */
11039 static UA_DataTypeMember MonitoredItemCreateRequest_members[3] = {
11041 #ifdef UA_ENABLE_TYPENAMES
11042  .memberName = "itemToMonitor",
11043 #endif
11044  .namespaceZero = true,
11045  .padding = 0,
11046  .isArray = false
11047  },
11048  { .memberTypeIndex = UA_TYPES_MONITORINGMODE,
11049 #ifdef UA_ENABLE_TYPENAMES
11050  .memberName = "monitoringMode",
11051 #endif
11052  .namespaceZero = true,
11053  .padding = offsetof(UA_MonitoredItemCreateRequest, monitoringMode) - offsetof(UA_MonitoredItemCreateRequest, itemToMonitor) - sizeof(UA_ReadValueId),
11054  .isArray = false
11055  },
11056  { .memberTypeIndex = UA_TYPES_MONITORINGPARAMETERS,
11057 #ifdef UA_ENABLE_TYPENAMES
11058  .memberName = "requestedParameters",
11059 #endif
11060  .namespaceZero = true,
11061  .padding = offsetof(UA_MonitoredItemCreateRequest, requestedParameters) - offsetof(UA_MonitoredItemCreateRequest, monitoringMode) - sizeof(UA_MonitoringMode),
11062  .isArray = false
11063  },};
11064 
11065 /* DeleteReferencesRequest */
11066 static UA_DataTypeMember DeleteReferencesRequest_members[2] = {
11068 #ifdef UA_ENABLE_TYPENAMES
11069  .memberName = "requestHeader",
11070 #endif
11071  .namespaceZero = true,
11072  .padding = 0,
11073  .isArray = false
11074  },
11075  { .memberTypeIndex = UA_TYPES_DELETEREFERENCESITEM,
11076 #ifdef UA_ENABLE_TYPENAMES
11077  .memberName = "referencesToDelete",
11078 #endif
11079  .namespaceZero = true,
11080  .padding = offsetof(UA_DeleteReferencesRequest, referencesToDeleteSize) - offsetof(UA_DeleteReferencesRequest, requestHeader) - sizeof(UA_RequestHeader),
11081  .isArray = true
11082  },};
11083 
11084 /* ModifyMonitoredItemsResponse */
11085 static UA_DataTypeMember ModifyMonitoredItemsResponse_members[3] = {
11087 #ifdef UA_ENABLE_TYPENAMES
11088  .memberName = "responseHeader",
11089 #endif
11090  .namespaceZero = true,
11091  .padding = 0,
11092  .isArray = false
11093  },
11094  { .memberTypeIndex = UA_TYPES_MONITOREDITEMMODIFYRESULT,
11095 #ifdef UA_ENABLE_TYPENAMES
11096  .memberName = "results",
11097 #endif
11098  .namespaceZero = true,
11099  .padding = offsetof(UA_ModifyMonitoredItemsResponse, resultsSize) - offsetof(UA_ModifyMonitoredItemsResponse, responseHeader) - sizeof(UA_ResponseHeader),
11100  .isArray = true
11101  },
11102  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11103 #ifdef UA_ENABLE_TYPENAMES
11104  .memberName = "diagnosticInfos",
11105 #endif
11106  .namespaceZero = true,
11107  .padding = offsetof(UA_ModifyMonitoredItemsResponse, diagnosticInfosSize) - offsetof(UA_ModifyMonitoredItemsResponse, results) - sizeof(void*),
11108  .isArray = true
11109  },};
11110 
11111 /* ReadResponse */
11112 static UA_DataTypeMember ReadResponse_members[3] = {
11114 #ifdef UA_ENABLE_TYPENAMES
11115  .memberName = "responseHeader",
11116 #endif
11117  .namespaceZero = true,
11118  .padding = 0,
11119  .isArray = false
11120  },
11121  { .memberTypeIndex = UA_TYPES_DATAVALUE,
11122 #ifdef UA_ENABLE_TYPENAMES
11123  .memberName = "results",
11124 #endif
11125  .namespaceZero = true,
11126  .padding = offsetof(UA_ReadResponse, resultsSize) - offsetof(UA_ReadResponse, responseHeader) - sizeof(UA_ResponseHeader),
11127  .isArray = true
11128  },
11129  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11130 #ifdef UA_ENABLE_TYPENAMES
11131  .memberName = "diagnosticInfos",
11132 #endif
11133  .namespaceZero = true,
11134  .padding = offsetof(UA_ReadResponse, diagnosticInfosSize) - offsetof(UA_ReadResponse, results) - sizeof(void*),
11135  .isArray = true
11136  },};
11137 
11138 /* AddReferencesRequest */
11139 static UA_DataTypeMember AddReferencesRequest_members[2] = {
11141 #ifdef UA_ENABLE_TYPENAMES
11142  .memberName = "requestHeader",
11143 #endif
11144  .namespaceZero = true,
11145  .padding = 0,
11146  .isArray = false
11147  },
11148  { .memberTypeIndex = UA_TYPES_ADDREFERENCESITEM,
11149 #ifdef UA_ENABLE_TYPENAMES
11150  .memberName = "referencesToAdd",
11151 #endif
11152  .namespaceZero = true,
11153  .padding = offsetof(UA_AddReferencesRequest, referencesToAddSize) - offsetof(UA_AddReferencesRequest, requestHeader) - sizeof(UA_RequestHeader),
11154  .isArray = true
11155  },};
11156 
11157 /* ReadRequest */
11158 static UA_DataTypeMember ReadRequest_members[4] = {
11160 #ifdef UA_ENABLE_TYPENAMES
11161  .memberName = "requestHeader",
11162 #endif
11163  .namespaceZero = true,
11164  .padding = 0,
11165  .isArray = false
11166  },
11167  { .memberTypeIndex = UA_TYPES_DOUBLE,
11168 #ifdef UA_ENABLE_TYPENAMES
11169  .memberName = "maxAge",
11170 #endif
11171  .namespaceZero = true,
11172  .padding = offsetof(UA_ReadRequest, maxAge) - offsetof(UA_ReadRequest, requestHeader) - sizeof(UA_RequestHeader),
11173  .isArray = false
11174  },
11175  { .memberTypeIndex = UA_TYPES_TIMESTAMPSTORETURN,
11176 #ifdef UA_ENABLE_TYPENAMES
11177  .memberName = "timestampsToReturn",
11178 #endif
11179  .namespaceZero = true,
11180  .padding = offsetof(UA_ReadRequest, timestampsToReturn) - offsetof(UA_ReadRequest, maxAge) - sizeof(UA_Double),
11181  .isArray = false
11182  },
11183  { .memberTypeIndex = UA_TYPES_READVALUEID,
11184 #ifdef UA_ENABLE_TYPENAMES
11185  .memberName = "nodesToRead",
11186 #endif
11187  .namespaceZero = true,
11188  .padding = offsetof(UA_ReadRequest, nodesToReadSize) - offsetof(UA_ReadRequest, timestampsToReturn) - sizeof(UA_TimestampsToReturn),
11189  .isArray = true
11190  },};
11191 
11192 /* AddNodesItem */
11193 static UA_DataTypeMember AddNodesItem_members[7] = {
11195 #ifdef UA_ENABLE_TYPENAMES
11196  .memberName = "parentNodeId",
11197 #endif
11198  .namespaceZero = true,
11199  .padding = 0,
11200  .isArray = false
11201  },
11202  { .memberTypeIndex = UA_TYPES_NODEID,
11203 #ifdef UA_ENABLE_TYPENAMES
11204  .memberName = "referenceTypeId",
11205 #endif
11206  .namespaceZero = true,
11207  .padding = offsetof(UA_AddNodesItem, referenceTypeId) - offsetof(UA_AddNodesItem, parentNodeId) - sizeof(UA_ExpandedNodeId),
11208  .isArray = false
11209  },
11210  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
11211 #ifdef UA_ENABLE_TYPENAMES
11212  .memberName = "requestedNewNodeId",
11213 #endif
11214  .namespaceZero = true,
11215  .padding = offsetof(UA_AddNodesItem, requestedNewNodeId) - offsetof(UA_AddNodesItem, referenceTypeId) - sizeof(UA_NodeId),
11216  .isArray = false
11217  },
11218  { .memberTypeIndex = UA_TYPES_QUALIFIEDNAME,
11219 #ifdef UA_ENABLE_TYPENAMES
11220  .memberName = "browseName",
11221 #endif
11222  .namespaceZero = true,
11223  .padding = offsetof(UA_AddNodesItem, browseName) - offsetof(UA_AddNodesItem, requestedNewNodeId) - sizeof(UA_ExpandedNodeId),
11224  .isArray = false
11225  },
11226  { .memberTypeIndex = UA_TYPES_NODECLASS,
11227 #ifdef UA_ENABLE_TYPENAMES
11228  .memberName = "nodeClass",
11229 #endif
11230  .namespaceZero = true,
11231  .padding = offsetof(UA_AddNodesItem, nodeClass) - offsetof(UA_AddNodesItem, browseName) - sizeof(UA_QualifiedName),
11232  .isArray = false
11233  },
11234  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
11235 #ifdef UA_ENABLE_TYPENAMES
11236  .memberName = "nodeAttributes",
11237 #endif
11238  .namespaceZero = true,
11239  .padding = offsetof(UA_AddNodesItem, nodeAttributes) - offsetof(UA_AddNodesItem, nodeClass) - sizeof(UA_NodeClass),
11240  .isArray = false
11241  },
11242  { .memberTypeIndex = UA_TYPES_EXPANDEDNODEID,
11243 #ifdef UA_ENABLE_TYPENAMES
11244  .memberName = "typeDefinition",
11245 #endif
11246  .namespaceZero = true,
11247  .padding = offsetof(UA_AddNodesItem, typeDefinition) - offsetof(UA_AddNodesItem, nodeAttributes) - sizeof(UA_ExtensionObject),
11248  .isArray = false
11249  },};
11250 
11251 /* ServerStatusDataType */
11252 static UA_DataTypeMember ServerStatusDataType_members[6] = {
11254 #ifdef UA_ENABLE_TYPENAMES
11255  .memberName = "startTime",
11256 #endif
11257  .namespaceZero = true,
11258  .padding = 0,
11259  .isArray = false
11260  },
11261  { .memberTypeIndex = UA_TYPES_DATETIME,
11262 #ifdef UA_ENABLE_TYPENAMES
11263  .memberName = "currentTime",
11264 #endif
11265  .namespaceZero = true,
11266  .padding = offsetof(UA_ServerStatusDataType, currentTime) - offsetof(UA_ServerStatusDataType, startTime) - sizeof(UA_DateTime),
11267  .isArray = false
11268  },
11269  { .memberTypeIndex = UA_TYPES_SERVERSTATE,
11270 #ifdef UA_ENABLE_TYPENAMES
11271  .memberName = "state",
11272 #endif
11273  .namespaceZero = true,
11274  .padding = offsetof(UA_ServerStatusDataType, state) - offsetof(UA_ServerStatusDataType, currentTime) - sizeof(UA_DateTime),
11275  .isArray = false
11276  },
11277  { .memberTypeIndex = UA_TYPES_BUILDINFO,
11278 #ifdef UA_ENABLE_TYPENAMES
11279  .memberName = "buildInfo",
11280 #endif
11281  .namespaceZero = true,
11282  .padding = offsetof(UA_ServerStatusDataType, buildInfo) - offsetof(UA_ServerStatusDataType, state) - sizeof(UA_ServerState),
11283  .isArray = false
11284  },
11285  { .memberTypeIndex = UA_TYPES_UINT32,
11286 #ifdef UA_ENABLE_TYPENAMES
11287  .memberName = "secondsTillShutdown",
11288 #endif
11289  .namespaceZero = true,
11290  .padding = offsetof(UA_ServerStatusDataType, secondsTillShutdown) - offsetof(UA_ServerStatusDataType, buildInfo) - sizeof(UA_BuildInfo),
11291  .isArray = false
11292  },
11293  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
11294 #ifdef UA_ENABLE_TYPENAMES
11295  .memberName = "shutdownReason",
11296 #endif
11297  .namespaceZero = true,
11298  .padding = offsetof(UA_ServerStatusDataType, shutdownReason) - offsetof(UA_ServerStatusDataType, secondsTillShutdown) - sizeof(UA_UInt32),
11299  .isArray = false
11300  },};
11301 
11302 /* AddReferencesResponse */
11303 static UA_DataTypeMember AddReferencesResponse_members[3] = {
11305 #ifdef UA_ENABLE_TYPENAMES
11306  .memberName = "responseHeader",
11307 #endif
11308  .namespaceZero = true,
11309  .padding = 0,
11310  .isArray = false
11311  },
11312  { .memberTypeIndex = UA_TYPES_STATUSCODE,
11313 #ifdef UA_ENABLE_TYPENAMES
11314  .memberName = "results",
11315 #endif
11316  .namespaceZero = true,
11317  .padding = offsetof(UA_AddReferencesResponse, resultsSize) - offsetof(UA_AddReferencesResponse, responseHeader) - sizeof(UA_ResponseHeader),
11318  .isArray = true
11319  },
11320  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11321 #ifdef UA_ENABLE_TYPENAMES
11322  .memberName = "diagnosticInfos",
11323 #endif
11324  .namespaceZero = true,
11325  .padding = offsetof(UA_AddReferencesResponse, diagnosticInfosSize) - offsetof(UA_AddReferencesResponse, results) - sizeof(void*),
11326  .isArray = true
11327  },};
11328 
11329 /* TranslateBrowsePathsToNodeIdsResponse */
11330 static UA_DataTypeMember TranslateBrowsePathsToNodeIdsResponse_members[3] = {
11332 #ifdef UA_ENABLE_TYPENAMES
11333  .memberName = "responseHeader",
11334 #endif
11335  .namespaceZero = true,
11336  .padding = 0,
11337  .isArray = false
11338  },
11339  { .memberTypeIndex = UA_TYPES_BROWSEPATHRESULT,
11340 #ifdef UA_ENABLE_TYPENAMES
11341  .memberName = "results",
11342 #endif
11343  .namespaceZero = true,
11344  .padding = offsetof(UA_TranslateBrowsePathsToNodeIdsResponse, resultsSize) - offsetof(UA_TranslateBrowsePathsToNodeIdsResponse, responseHeader) - sizeof(UA_ResponseHeader),
11345  .isArray = true
11346  },
11347  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11348 #ifdef UA_ENABLE_TYPENAMES
11349  .memberName = "diagnosticInfos",
11350 #endif
11351  .namespaceZero = true,
11352  .padding = offsetof(UA_TranslateBrowsePathsToNodeIdsResponse, diagnosticInfosSize) - offsetof(UA_TranslateBrowsePathsToNodeIdsResponse, results) - sizeof(void*),
11353  .isArray = true
11354  },};
11355 
11356 /* DataChangeFilter */
11357 static UA_DataTypeMember DataChangeFilter_members[3] = {
11359 #ifdef UA_ENABLE_TYPENAMES
11360  .memberName = "trigger",
11361 #endif
11362  .namespaceZero = true,
11363  .padding = 0,
11364  .isArray = false
11365  },
11366  { .memberTypeIndex = UA_TYPES_UINT32,
11367 #ifdef UA_ENABLE_TYPENAMES
11368  .memberName = "deadbandType",
11369 #endif
11370  .namespaceZero = true,
11371  .padding = offsetof(UA_DataChangeFilter, deadbandType) - offsetof(UA_DataChangeFilter, trigger) - sizeof(UA_DataChangeTrigger),
11372  .isArray = false
11373  },
11374  { .memberTypeIndex = UA_TYPES_DOUBLE,
11375 #ifdef UA_ENABLE_TYPENAMES
11376  .memberName = "deadbandValue",
11377 #endif
11378  .namespaceZero = true,
11379  .padding = offsetof(UA_DataChangeFilter, deadbandValue) - offsetof(UA_DataChangeFilter, deadbandType) - sizeof(UA_UInt32),
11380  .isArray = false
11381  },};
11382 
11383 /* ContentFilterElement */
11384 static UA_DataTypeMember ContentFilterElement_members[2] = {
11386 #ifdef UA_ENABLE_TYPENAMES
11387  .memberName = "filterOperator",
11388 #endif
11389  .namespaceZero = true,
11390  .padding = 0,
11391  .isArray = false
11392  },
11393  { .memberTypeIndex = UA_TYPES_EXTENSIONOBJECT,
11394 #ifdef UA_ENABLE_TYPENAMES
11395  .memberName = "filterOperands",
11396 #endif
11397  .namespaceZero = true,
11398  .padding = offsetof(UA_ContentFilterElement, filterOperandsSize) - offsetof(UA_ContentFilterElement, filterOperator) - sizeof(UA_FilterOperator),
11399  .isArray = true
11400  },};
11401 
11402 /* CloseSessionResponse */
11403 static UA_DataTypeMember CloseSessionResponse_members[1] = {
11405 #ifdef UA_ENABLE_TYPENAMES
11406  .memberName = "responseHeader",
11407 #endif
11408  .namespaceZero = true,
11409  .padding = 0,
11410  .isArray = false
11411  },};
11412 
11413 /* ApplicationDescription */
11414 static UA_DataTypeMember ApplicationDescription_members[7] = {
11416 #ifdef UA_ENABLE_TYPENAMES
11417  .memberName = "applicationUri",
11418 #endif
11419  .namespaceZero = true,
11420  .padding = 0,
11421  .isArray = false
11422  },
11423  { .memberTypeIndex = UA_TYPES_STRING,
11424 #ifdef UA_ENABLE_TYPENAMES
11425  .memberName = "productUri",
11426 #endif
11427  .namespaceZero = true,
11428  .padding = offsetof(UA_ApplicationDescription, productUri) - offsetof(UA_ApplicationDescription, applicationUri) - sizeof(UA_String),
11429  .isArray = false
11430  },
11431  { .memberTypeIndex = UA_TYPES_LOCALIZEDTEXT,
11432 #ifdef UA_ENABLE_TYPENAMES
11433  .memberName = "applicationName",
11434 #endif
11435  .namespaceZero = true,
11436  .padding = offsetof(UA_ApplicationDescription, applicationName) - offsetof(UA_ApplicationDescription, productUri) - sizeof(UA_String),
11437  .isArray = false
11438  },
11439  { .memberTypeIndex = UA_TYPES_APPLICATIONTYPE,
11440 #ifdef UA_ENABLE_TYPENAMES
11441  .memberName = "applicationType",
11442 #endif
11443  .namespaceZero = true,
11444  .padding = offsetof(UA_ApplicationDescription, applicationType) - offsetof(UA_ApplicationDescription, applicationName) - sizeof(UA_LocalizedText),
11445  .isArray = false
11446  },
11447  { .memberTypeIndex = UA_TYPES_STRING,
11448 #ifdef UA_ENABLE_TYPENAMES
11449  .memberName = "gatewayServerUri",
11450 #endif
11451  .namespaceZero = true,
11452  .padding = offsetof(UA_ApplicationDescription, gatewayServerUri) - offsetof(UA_ApplicationDescription, applicationType) - sizeof(UA_ApplicationType),
11453  .isArray = false
11454  },
11455  { .memberTypeIndex = UA_TYPES_STRING,
11456 #ifdef UA_ENABLE_TYPENAMES
11457  .memberName = "discoveryProfileUri",
11458 #endif
11459  .namespaceZero = true,
11460  .padding = offsetof(UA_ApplicationDescription, discoveryProfileUri) - offsetof(UA_ApplicationDescription, gatewayServerUri) - sizeof(UA_String),
11461  .isArray = false
11462  },
11463  { .memberTypeIndex = UA_TYPES_STRING,
11464 #ifdef UA_ENABLE_TYPENAMES
11465  .memberName = "discoveryUrls",
11466 #endif
11467  .namespaceZero = true,
11468  .padding = offsetof(UA_ApplicationDescription, discoveryUrlsSize) - offsetof(UA_ApplicationDescription, discoveryProfileUri) - sizeof(UA_String),
11469  .isArray = true
11470  },};
11471 
11472 /* ServiceFault */
11473 static UA_DataTypeMember ServiceFault_members[1] = {
11475 #ifdef UA_ENABLE_TYPENAMES
11476  .memberName = "responseHeader",
11477 #endif
11478  .namespaceZero = true,
11479  .padding = 0,
11480  .isArray = false
11481  },};
11482 
11483 /* FindServersResponse */
11484 static UA_DataTypeMember FindServersResponse_members[2] = {
11486 #ifdef UA_ENABLE_TYPENAMES
11487  .memberName = "responseHeader",
11488 #endif
11489  .namespaceZero = true,
11490  .padding = 0,
11491  .isArray = false
11492  },
11493  { .memberTypeIndex = UA_TYPES_APPLICATIONDESCRIPTION,
11494 #ifdef UA_ENABLE_TYPENAMES
11495  .memberName = "servers",
11496 #endif
11497  .namespaceZero = true,
11498  .padding = offsetof(UA_FindServersResponse, serversSize) - offsetof(UA_FindServersResponse, responseHeader) - sizeof(UA_ResponseHeader),
11499  .isArray = true
11500  },};
11501 
11502 /* CreateMonitoredItemsRequest */
11503 static UA_DataTypeMember CreateMonitoredItemsRequest_members[4] = {
11505 #ifdef UA_ENABLE_TYPENAMES
11506  .memberName = "requestHeader",
11507 #endif
11508  .namespaceZero = true,
11509  .padding = 0,
11510  .isArray = false
11511  },
11512  { .memberTypeIndex = UA_TYPES_UINT32,
11513 #ifdef UA_ENABLE_TYPENAMES
11514  .memberName = "subscriptionId",
11515 #endif
11516  .namespaceZero = true,
11517  .padding = offsetof(UA_CreateMonitoredItemsRequest, subscriptionId) - offsetof(UA_CreateMonitoredItemsRequest, requestHeader) - sizeof(UA_RequestHeader),
11518  .isArray = false
11519  },
11520  { .memberTypeIndex = UA_TYPES_TIMESTAMPSTORETURN,
11521 #ifdef UA_ENABLE_TYPENAMES
11522  .memberName = "timestampsToReturn",
11523 #endif
11524  .namespaceZero = true,
11525  .padding = offsetof(UA_CreateMonitoredItemsRequest, timestampsToReturn) - offsetof(UA_CreateMonitoredItemsRequest, subscriptionId) - sizeof(UA_UInt32),
11526  .isArray = false
11527  },
11528  { .memberTypeIndex = UA_TYPES_MONITOREDITEMCREATEREQUEST,
11529 #ifdef UA_ENABLE_TYPENAMES
11530  .memberName = "itemsToCreate",
11531 #endif
11532  .namespaceZero = true,
11533  .padding = offsetof(UA_CreateMonitoredItemsRequest, itemsToCreateSize) - offsetof(UA_CreateMonitoredItemsRequest, timestampsToReturn) - sizeof(UA_TimestampsToReturn),
11534  .isArray = true
11535  },};
11536 
11537 /* ContentFilter */
11538 static UA_DataTypeMember ContentFilter_members[1] = {
11540 #ifdef UA_ENABLE_TYPENAMES
11541  .memberName = "elements",
11542 #endif
11543  .namespaceZero = true,
11544  .padding = 0,
11545  .isArray = true
11546  },};
11547 
11548 /* QueryFirstResponse */
11549 static UA_DataTypeMember QueryFirstResponse_members[6] = {
11551 #ifdef UA_ENABLE_TYPENAMES
11552  .memberName = "responseHeader",
11553 #endif
11554  .namespaceZero = true,
11555  .padding = 0,
11556  .isArray = false
11557  },
11558  { .memberTypeIndex = UA_TYPES_QUERYDATASET,
11559 #ifdef UA_ENABLE_TYPENAMES
11560  .memberName = "queryDataSets",
11561 #endif
11562  .namespaceZero = true,
11563  .padding = offsetof(UA_QueryFirstResponse, queryDataSetsSize) - offsetof(UA_QueryFirstResponse, responseHeader) - sizeof(UA_ResponseHeader),
11564  .isArray = true
11565  },
11566  { .memberTypeIndex = UA_TYPES_BYTESTRING,
11567 #ifdef UA_ENABLE_TYPENAMES
11568  .memberName = "continuationPoint",
11569 #endif
11570  .namespaceZero = true,
11571  .padding = offsetof(UA_QueryFirstResponse, continuationPoint) - offsetof(UA_QueryFirstResponse, queryDataSets) - sizeof(void*),
11572  .isArray = false
11573  },
11574  { .memberTypeIndex = UA_TYPES_PARSINGRESULT,
11575 #ifdef UA_ENABLE_TYPENAMES
11576  .memberName = "parsingResults",
11577 #endif
11578  .namespaceZero = true,
11579  .padding = offsetof(UA_QueryFirstResponse, parsingResultsSize) - offsetof(UA_QueryFirstResponse, continuationPoint) - sizeof(UA_ByteString),
11580  .isArray = true
11581  },
11582  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11583 #ifdef UA_ENABLE_TYPENAMES
11584  .memberName = "diagnosticInfos",
11585 #endif
11586  .namespaceZero = true,
11587  .padding = offsetof(UA_QueryFirstResponse, diagnosticInfosSize) - offsetof(UA_QueryFirstResponse, parsingResults) - sizeof(void*),
11588  .isArray = true
11589  },
11590  { .memberTypeIndex = UA_TYPES_CONTENTFILTERRESULT,
11591 #ifdef UA_ENABLE_TYPENAMES
11592  .memberName = "filterResult",
11593 #endif
11594  .namespaceZero = true,
11595  .padding = offsetof(UA_QueryFirstResponse, filterResult) - offsetof(UA_QueryFirstResponse, diagnosticInfos) - sizeof(void*),
11596  .isArray = false
11597  },};
11598 
11599 /* AddNodesRequest */
11600 static UA_DataTypeMember AddNodesRequest_members[2] = {
11602 #ifdef UA_ENABLE_TYPENAMES
11603  .memberName = "requestHeader",
11604 #endif
11605  .namespaceZero = true,
11606  .padding = 0,
11607  .isArray = false
11608  },
11609  { .memberTypeIndex = UA_TYPES_ADDNODESITEM,
11610 #ifdef UA_ENABLE_TYPENAMES
11611  .memberName = "nodesToAdd",
11612 #endif
11613  .namespaceZero = true,
11614  .padding = offsetof(UA_AddNodesRequest, nodesToAddSize) - offsetof(UA_AddNodesRequest, requestHeader) - sizeof(UA_RequestHeader),
11615  .isArray = true
11616  },};
11617 
11618 /* BrowseRequest */
11619 static UA_DataTypeMember BrowseRequest_members[4] = {
11621 #ifdef UA_ENABLE_TYPENAMES
11622  .memberName = "requestHeader",
11623 #endif
11624  .namespaceZero = true,
11625  .padding = 0,
11626  .isArray = false
11627  },
11628  { .memberTypeIndex = UA_TYPES_VIEWDESCRIPTION,
11629 #ifdef UA_ENABLE_TYPENAMES
11630  .memberName = "view",
11631 #endif
11632  .namespaceZero = true,
11633  .padding = offsetof(UA_BrowseRequest, view) - offsetof(UA_BrowseRequest, requestHeader) - sizeof(UA_RequestHeader),
11634  .isArray = false
11635  },
11636  { .memberTypeIndex = UA_TYPES_UINT32,
11637 #ifdef UA_ENABLE_TYPENAMES
11638  .memberName = "requestedMaxReferencesPerNode",
11639 #endif
11640  .namespaceZero = true,
11641  .padding = offsetof(UA_BrowseRequest, requestedMaxReferencesPerNode) - offsetof(UA_BrowseRequest, view) - sizeof(UA_ViewDescription),
11642  .isArray = false
11643  },
11644  { .memberTypeIndex = UA_TYPES_BROWSEDESCRIPTION,
11645 #ifdef UA_ENABLE_TYPENAMES
11646  .memberName = "nodesToBrowse",
11647 #endif
11648  .namespaceZero = true,
11649  .padding = offsetof(UA_BrowseRequest, nodesToBrowseSize) - offsetof(UA_BrowseRequest, requestedMaxReferencesPerNode) - sizeof(UA_UInt32),
11650  .isArray = true
11651  },};
11652 
11653 /* BrowsePath */
11654 static UA_DataTypeMember BrowsePath_members[2] = {
11656 #ifdef UA_ENABLE_TYPENAMES
11657  .memberName = "startingNode",
11658 #endif
11659  .namespaceZero = true,
11660  .padding = 0,
11661  .isArray = false
11662  },
11663  { .memberTypeIndex = UA_TYPES_RELATIVEPATH,
11664 #ifdef UA_ENABLE_TYPENAMES
11665  .memberName = "relativePath",
11666 #endif
11667  .namespaceZero = true,
11668  .padding = offsetof(UA_BrowsePath, relativePath) - offsetof(UA_BrowsePath, startingNode) - sizeof(UA_NodeId),
11669  .isArray = false
11670  },};
11671 
11672 /* BrowseResult */
11673 static UA_DataTypeMember BrowseResult_members[3] = {
11675 #ifdef UA_ENABLE_TYPENAMES
11676  .memberName = "statusCode",
11677 #endif
11678  .namespaceZero = true,
11679  .padding = 0,
11680  .isArray = false
11681  },
11682  { .memberTypeIndex = UA_TYPES_BYTESTRING,
11683 #ifdef UA_ENABLE_TYPENAMES
11684  .memberName = "continuationPoint",
11685 #endif
11686  .namespaceZero = true,
11687  .padding = offsetof(UA_BrowseResult, continuationPoint) - offsetof(UA_BrowseResult, statusCode) - sizeof(UA_StatusCode),
11688  .isArray = false
11689  },
11690  { .memberTypeIndex = UA_TYPES_REFERENCEDESCRIPTION,
11691 #ifdef UA_ENABLE_TYPENAMES
11692  .memberName = "references",
11693 #endif
11694  .namespaceZero = true,
11695  .padding = offsetof(UA_BrowseResult, referencesSize) - offsetof(UA_BrowseResult, continuationPoint) - sizeof(UA_ByteString),
11696  .isArray = true
11697  },};
11698 
11699 /* CreateSessionRequest */
11700 static UA_DataTypeMember CreateSessionRequest_members[9] = {
11702 #ifdef UA_ENABLE_TYPENAMES
11703  .memberName = "requestHeader",
11704 #endif
11705  .namespaceZero = true,
11706  .padding = 0,
11707  .isArray = false
11708  },
11709  { .memberTypeIndex = UA_TYPES_APPLICATIONDESCRIPTION,
11710 #ifdef UA_ENABLE_TYPENAMES
11711  .memberName = "clientDescription",
11712 #endif
11713  .namespaceZero = true,
11714  .padding = offsetof(UA_CreateSessionRequest, clientDescription) - offsetof(UA_CreateSessionRequest, requestHeader) - sizeof(UA_RequestHeader),
11715  .isArray = false
11716  },
11717  { .memberTypeIndex = UA_TYPES_STRING,
11718 #ifdef UA_ENABLE_TYPENAMES
11719  .memberName = "serverUri",
11720 #endif
11721  .namespaceZero = true,
11722  .padding = offsetof(UA_CreateSessionRequest, serverUri) - offsetof(UA_CreateSessionRequest, clientDescription) - sizeof(UA_ApplicationDescription),
11723  .isArray = false
11724  },
11725  { .memberTypeIndex = UA_TYPES_STRING,
11726 #ifdef UA_ENABLE_TYPENAMES
11727  .memberName = "endpointUrl",
11728 #endif
11729  .namespaceZero = true,
11730  .padding = offsetof(UA_CreateSessionRequest, endpointUrl) - offsetof(UA_CreateSessionRequest, serverUri) - sizeof(UA_String),
11731  .isArray = false
11732  },
11733  { .memberTypeIndex = UA_TYPES_STRING,
11734 #ifdef UA_ENABLE_TYPENAMES
11735  .memberName = "sessionName",
11736 #endif
11737  .namespaceZero = true,
11738  .padding = offsetof(UA_CreateSessionRequest, sessionName) - offsetof(UA_CreateSessionRequest, endpointUrl) - sizeof(UA_String),
11739  .isArray = false
11740  },
11741  { .memberTypeIndex = UA_TYPES_BYTESTRING,
11742 #ifdef UA_ENABLE_TYPENAMES
11743  .memberName = "clientNonce",
11744 #endif
11745  .namespaceZero = true,
11746  .padding = offsetof(UA_CreateSessionRequest, clientNonce) - offsetof(UA_CreateSessionRequest, sessionName) - sizeof(UA_String),
11747  .isArray = false
11748  },
11749  { .memberTypeIndex = UA_TYPES_BYTESTRING,
11750 #ifdef UA_ENABLE_TYPENAMES
11751  .memberName = "clientCertificate",
11752 #endif
11753  .namespaceZero = true,
11754  .padding = offsetof(UA_CreateSessionRequest, clientCertificate) - offsetof(UA_CreateSessionRequest, clientNonce) - sizeof(UA_ByteString),
11755  .isArray = false
11756  },
11757  { .memberTypeIndex = UA_TYPES_DOUBLE,
11758 #ifdef UA_ENABLE_TYPENAMES
11759  .memberName = "requestedSessionTimeout",
11760 #endif
11761  .namespaceZero = true,
11762  .padding = offsetof(UA_CreateSessionRequest, requestedSessionTimeout) - offsetof(UA_CreateSessionRequest, clientCertificate) - sizeof(UA_ByteString),
11763  .isArray = false
11764  },
11765  { .memberTypeIndex = UA_TYPES_UINT32,
11766 #ifdef UA_ENABLE_TYPENAMES
11767  .memberName = "maxResponseMessageSize",
11768 #endif
11769  .namespaceZero = true,
11770  .padding = offsetof(UA_CreateSessionRequest, maxResponseMessageSize) - offsetof(UA_CreateSessionRequest, requestedSessionTimeout) - sizeof(UA_Double),
11771  .isArray = false
11772  },};
11773 
11774 /* QueryDataDescription */
11775 static UA_DataTypeMember QueryDataDescription_members[3] = {
11777 #ifdef UA_ENABLE_TYPENAMES
11778  .memberName = "relativePath",
11779 #endif
11780  .namespaceZero = true,
11781  .padding = 0,
11782  .isArray = false
11783  },
11784  { .memberTypeIndex = UA_TYPES_UINT32,
11785 #ifdef UA_ENABLE_TYPENAMES
11786  .memberName = "attributeId",
11787 #endif
11788  .namespaceZero = true,
11789  .padding = offsetof(UA_QueryDataDescription, attributeId) - offsetof(UA_QueryDataDescription, relativePath) - sizeof(UA_RelativePath),
11790  .isArray = false
11791  },
11792  { .memberTypeIndex = UA_TYPES_STRING,
11793 #ifdef UA_ENABLE_TYPENAMES
11794  .memberName = "indexRange",
11795 #endif
11796  .namespaceZero = true,
11797  .padding = offsetof(UA_QueryDataDescription, indexRange) - offsetof(UA_QueryDataDescription, attributeId) - sizeof(UA_UInt32),
11798  .isArray = false
11799  },};
11800 
11801 /* EndpointDescription */
11802 static UA_DataTypeMember EndpointDescription_members[8] = {
11804 #ifdef UA_ENABLE_TYPENAMES
11805  .memberName = "endpointUrl",
11806 #endif
11807  .namespaceZero = true,
11808  .padding = 0,
11809  .isArray = false
11810  },
11811  { .memberTypeIndex = UA_TYPES_APPLICATIONDESCRIPTION,
11812 #ifdef UA_ENABLE_TYPENAMES
11813  .memberName = "server",
11814 #endif
11815  .namespaceZero = true,
11816  .padding = offsetof(UA_EndpointDescription, server) - offsetof(UA_EndpointDescription, endpointUrl) - sizeof(UA_String),
11817  .isArray = false
11818  },
11819  { .memberTypeIndex = UA_TYPES_BYTESTRING,
11820 #ifdef UA_ENABLE_TYPENAMES
11821  .memberName = "serverCertificate",
11822 #endif
11823  .namespaceZero = true,
11824  .padding = offsetof(UA_EndpointDescription, serverCertificate) - offsetof(UA_EndpointDescription, server) - sizeof(UA_ApplicationDescription),
11825  .isArray = false
11826  },
11827  { .memberTypeIndex = UA_TYPES_MESSAGESECURITYMODE,
11828 #ifdef UA_ENABLE_TYPENAMES
11829  .memberName = "securityMode",
11830 #endif
11831  .namespaceZero = true,
11832  .padding = offsetof(UA_EndpointDescription, securityMode) - offsetof(UA_EndpointDescription, serverCertificate) - sizeof(UA_ByteString),
11833  .isArray = false
11834  },
11835  { .memberTypeIndex = UA_TYPES_STRING,
11836 #ifdef UA_ENABLE_TYPENAMES
11837  .memberName = "securityPolicyUri",
11838 #endif
11839  .namespaceZero = true,
11840  .padding = offsetof(UA_EndpointDescription, securityPolicyUri) - offsetof(UA_EndpointDescription, securityMode) - sizeof(UA_MessageSecurityMode),
11841  .isArray = false
11842  },
11843  { .memberTypeIndex = UA_TYPES_USERTOKENPOLICY,
11844 #ifdef UA_ENABLE_TYPENAMES
11845  .memberName = "userIdentityTokens",
11846 #endif
11847  .namespaceZero = true,
11848  .padding = offsetof(UA_EndpointDescription, userIdentityTokensSize) - offsetof(UA_EndpointDescription, securityPolicyUri) - sizeof(UA_String),
11849  .isArray = true
11850  },
11851  { .memberTypeIndex = UA_TYPES_STRING,
11852 #ifdef UA_ENABLE_TYPENAMES
11853  .memberName = "transportProfileUri",
11854 #endif
11855  .namespaceZero = true,
11856  .padding = offsetof(UA_EndpointDescription, transportProfileUri) - offsetof(UA_EndpointDescription, userIdentityTokens) - sizeof(void*),
11857  .isArray = false
11858  },
11859  { .memberTypeIndex = UA_TYPES_BYTE,
11860 #ifdef UA_ENABLE_TYPENAMES
11861  .memberName = "securityLevel",
11862 #endif
11863  .namespaceZero = true,
11864  .padding = offsetof(UA_EndpointDescription, securityLevel) - offsetof(UA_EndpointDescription, transportProfileUri) - sizeof(UA_String),
11865  .isArray = false
11866  },};
11867 
11868 /* GetEndpointsResponse */
11869 static UA_DataTypeMember GetEndpointsResponse_members[2] = {
11871 #ifdef UA_ENABLE_TYPENAMES
11872  .memberName = "responseHeader",
11873 #endif
11874  .namespaceZero = true,
11875  .padding = 0,
11876  .isArray = false
11877  },
11878  { .memberTypeIndex = UA_TYPES_ENDPOINTDESCRIPTION,
11879 #ifdef UA_ENABLE_TYPENAMES
11880  .memberName = "endpoints",
11881 #endif
11882  .namespaceZero = true,
11883  .padding = offsetof(UA_GetEndpointsResponse, endpointsSize) - offsetof(UA_GetEndpointsResponse, responseHeader) - sizeof(UA_ResponseHeader),
11884  .isArray = true
11885  },};
11886 
11887 /* NodeTypeDescription */
11888 static UA_DataTypeMember NodeTypeDescription_members[3] = {
11890 #ifdef UA_ENABLE_TYPENAMES
11891  .memberName = "typeDefinitionNode",
11892 #endif
11893  .namespaceZero = true,
11894  .padding = 0,
11895  .isArray = false
11896  },
11897  { .memberTypeIndex = UA_TYPES_BOOLEAN,
11898 #ifdef UA_ENABLE_TYPENAMES
11899  .memberName = "includeSubTypes",
11900 #endif
11901  .namespaceZero = true,
11902  .padding = offsetof(UA_NodeTypeDescription, includeSubTypes) - offsetof(UA_NodeTypeDescription, typeDefinitionNode) - sizeof(UA_ExpandedNodeId),
11903  .isArray = false
11904  },
11905  { .memberTypeIndex = UA_TYPES_QUERYDATADESCRIPTION,
11906 #ifdef UA_ENABLE_TYPENAMES
11907  .memberName = "dataToReturn",
11908 #endif
11909  .namespaceZero = true,
11910  .padding = offsetof(UA_NodeTypeDescription, dataToReturnSize) - offsetof(UA_NodeTypeDescription, includeSubTypes) - sizeof(UA_Boolean),
11911  .isArray = true
11912  },};
11913 
11914 /* BrowseNextResponse */
11915 static UA_DataTypeMember BrowseNextResponse_members[3] = {
11917 #ifdef UA_ENABLE_TYPENAMES
11918  .memberName = "responseHeader",
11919 #endif
11920  .namespaceZero = true,
11921  .padding = 0,
11922  .isArray = false
11923  },
11924  { .memberTypeIndex = UA_TYPES_BROWSERESULT,
11925 #ifdef UA_ENABLE_TYPENAMES
11926  .memberName = "results",
11927 #endif
11928  .namespaceZero = true,
11929  .padding = offsetof(UA_BrowseNextResponse, resultsSize) - offsetof(UA_BrowseNextResponse, responseHeader) - sizeof(UA_ResponseHeader),
11930  .isArray = true
11931  },
11932  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11933 #ifdef UA_ENABLE_TYPENAMES
11934  .memberName = "diagnosticInfos",
11935 #endif
11936  .namespaceZero = true,
11937  .padding = offsetof(UA_BrowseNextResponse, diagnosticInfosSize) - offsetof(UA_BrowseNextResponse, results) - sizeof(void*),
11938  .isArray = true
11939  },};
11940 
11941 /* TranslateBrowsePathsToNodeIdsRequest */
11942 static UA_DataTypeMember TranslateBrowsePathsToNodeIdsRequest_members[2] = {
11944 #ifdef UA_ENABLE_TYPENAMES
11945  .memberName = "requestHeader",
11946 #endif
11947  .namespaceZero = true,
11948  .padding = 0,
11949  .isArray = false
11950  },
11951  { .memberTypeIndex = UA_TYPES_BROWSEPATH,
11952 #ifdef UA_ENABLE_TYPENAMES
11953  .memberName = "browsePaths",
11954 #endif
11955  .namespaceZero = true,
11956  .padding = offsetof(UA_TranslateBrowsePathsToNodeIdsRequest, browsePathsSize) - offsetof(UA_TranslateBrowsePathsToNodeIdsRequest, requestHeader) - sizeof(UA_RequestHeader),
11957  .isArray = true
11958  },};
11959 
11960 /* BrowseResponse */
11961 static UA_DataTypeMember BrowseResponse_members[3] = {
11963 #ifdef UA_ENABLE_TYPENAMES
11964  .memberName = "responseHeader",
11965 #endif
11966  .namespaceZero = true,
11967  .padding = 0,
11968  .isArray = false
11969  },
11970  { .memberTypeIndex = UA_TYPES_BROWSERESULT,
11971 #ifdef UA_ENABLE_TYPENAMES
11972  .memberName = "results",
11973 #endif
11974  .namespaceZero = true,
11975  .padding = offsetof(UA_BrowseResponse, resultsSize) - offsetof(UA_BrowseResponse, responseHeader) - sizeof(UA_ResponseHeader),
11976  .isArray = true
11977  },
11978  { .memberTypeIndex = UA_TYPES_DIAGNOSTICINFO,
11979 #ifdef UA_ENABLE_TYPENAMES
11980  .memberName = "diagnosticInfos",
11981 #endif
11982  .namespaceZero = true,
11983  .padding = offsetof(UA_BrowseResponse, diagnosticInfosSize) - offsetof(UA_BrowseResponse, results) - sizeof(void*),
11984  .isArray = true
11985  },};
11986 
11987 /* CreateSessionResponse */
11988 static UA_DataTypeMember CreateSessionResponse_members[10] = {
11990 #ifdef UA_ENABLE_TYPENAMES
11991  .memberName = "responseHeader",
11992 #endif
11993  .namespaceZero = true,
11994  .padding = 0,
11995  .isArray = false
11996  },
11997  { .memberTypeIndex = UA_TYPES_NODEID,
11998 #ifdef UA_ENABLE_TYPENAMES
11999  .memberName = "sessionId",
12000 #endif
12001  .namespaceZero = true,
12002  .padding = offsetof(UA_CreateSessionResponse, sessionId) - offsetof(UA_CreateSessionResponse, responseHeader) - sizeof(UA_ResponseHeader),
12003  .isArray = false
12004  },
12005  { .memberTypeIndex = UA_TYPES_NODEID,
12006 #ifdef UA_ENABLE_TYPENAMES
12007  .memberName = "authenticationToken",
12008 #endif
12009  .namespaceZero = true,
12010  .padding = offsetof(UA_CreateSessionResponse, authenticationToken) - offsetof(UA_CreateSessionResponse, sessionId) - sizeof(UA_NodeId),
12011  .isArray = false
12012  },
12013  { .memberTypeIndex = UA_TYPES_DOUBLE,
12014 #ifdef UA_ENABLE_TYPENAMES
12015  .memberName = "revisedSessionTimeout",
12016 #endif
12017  .namespaceZero = true,
12018  .padding = offsetof(UA_CreateSessionResponse, revisedSessionTimeout) - offsetof(UA_CreateSessionResponse, authenticationToken) - sizeof(UA_NodeId),
12019  .isArray = false
12020  },
12021  { .memberTypeIndex = UA_TYPES_BYTESTRING,
12022 #ifdef UA_ENABLE_TYPENAMES
12023  .memberName = "serverNonce",
12024 #endif
12025  .namespaceZero = true,
12026  .padding = offsetof(UA_CreateSessionResponse, serverNonce) - offsetof(UA_CreateSessionResponse, revisedSessionTimeout) - sizeof(UA_Double),
12027  .isArray = false
12028  },
12029  { .memberTypeIndex = UA_TYPES_BYTESTRING,
12030 #ifdef UA_ENABLE_TYPENAMES
12031  .memberName = "serverCertificate",
12032 #endif
12033  .namespaceZero = true,
12034  .padding = offsetof(UA_CreateSessionResponse, serverCertificate) - offsetof(UA_CreateSessionResponse, serverNonce) - sizeof(UA_ByteString),
12035  .isArray = false
12036  },
12037  { .memberTypeIndex = UA_TYPES_ENDPOINTDESCRIPTION,
12038 #ifdef UA_ENABLE_TYPENAMES
12039  .memberName = "serverEndpoints",
12040 #endif
12041  .namespaceZero = true,
12042  .padding = offsetof(UA_CreateSessionResponse, serverEndpointsSize) - offsetof(UA_CreateSessionResponse, serverCertificate) - sizeof(UA_ByteString),
12043  .isArray = true
12044  },
12045  { .memberTypeIndex = UA_TYPES_SIGNEDSOFTWARECERTIFICATE,
12046 #ifdef UA_ENABLE_TYPENAMES
12047  .memberName = "serverSoftwareCertificates",
12048 #endif
12049  .namespaceZero = true,
12050  .padding = offsetof(UA_CreateSessionResponse, serverSoftwareCertificatesSize) - offsetof(UA_CreateSessionResponse, serverEndpoints) - sizeof(void*),
12051  .isArray = true
12052  },
12053  { .memberTypeIndex = UA_TYPES_SIGNATUREDATA,
12054 #ifdef UA_ENABLE_TYPENAMES
12055  .memberName = "serverSignature",
12056 #endif
12057  .namespaceZero = true,
12058  .padding = offsetof(UA_CreateSessionResponse, serverSignature) - offsetof(UA_CreateSessionResponse, serverSoftwareCertificates) - sizeof(void*),
12059  .isArray = false
12060  },
12061  { .memberTypeIndex = UA_TYPES_UINT32,
12062 #ifdef UA_ENABLE_TYPENAMES
12063  .memberName = "maxRequestMessageSize",
12064 #endif
12065  .namespaceZero = true,
12066  .padding = offsetof(UA_CreateSessionResponse, maxRequestMessageSize) - offsetof(UA_CreateSessionResponse, serverSignature) - sizeof(UA_SignatureData),
12067  .isArray = false
12068  },};
12069 
12070 /* QueryFirstRequest */
12071 static UA_DataTypeMember QueryFirstRequest_members[6] = {
12073 #ifdef UA_ENABLE_TYPENAMES
12074  .memberName = "requestHeader",
12075 #endif
12076  .namespaceZero = true,
12077  .padding = 0,
12078  .isArray = false
12079  },
12080  { .memberTypeIndex = UA_TYPES_VIEWDESCRIPTION,
12081 #ifdef UA_ENABLE_TYPENAMES
12082  .memberName = "view",
12083 #endif
12084  .namespaceZero = true,
12085  .padding = offsetof(UA_QueryFirstRequest, view) - offsetof(UA_QueryFirstRequest, requestHeader) - sizeof(UA_RequestHeader),
12086  .isArray = false
12087  },
12088  { .memberTypeIndex = UA_TYPES_NODETYPEDESCRIPTION,
12089 #ifdef UA_ENABLE_TYPENAMES
12090  .memberName = "nodeTypes",
12091 #endif
12092  .namespaceZero = true,
12093  .padding = offsetof(UA_QueryFirstRequest, nodeTypesSize) - offsetof(UA_QueryFirstRequest, view) - sizeof(UA_ViewDescription),
12094  .isArray = true
12095  },
12096  { .memberTypeIndex = UA_TYPES_CONTENTFILTER,
12097 #ifdef UA_ENABLE_TYPENAMES
12098  .memberName = "filter",
12099 #endif
12100  .namespaceZero = true,
12101  .padding = offsetof(UA_QueryFirstRequest, filter) - offsetof(UA_QueryFirstRequest, nodeTypes) - sizeof(void*),
12102  .isArray = false
12103  },
12104  { .memberTypeIndex = UA_TYPES_UINT32,
12105 #ifdef UA_ENABLE_TYPENAMES
12106  .memberName = "maxDataSetsToReturn",
12107 #endif
12108  .namespaceZero = true,
12109  .padding = offsetof(UA_QueryFirstRequest, maxDataSetsToReturn) - offsetof(UA_QueryFirstRequest, filter) - sizeof(UA_ContentFilter),
12110  .isArray = false
12111  },
12112  { .memberTypeIndex = UA_TYPES_UINT32,
12113 #ifdef UA_ENABLE_TYPENAMES
12114  .memberName = "maxReferencesToReturn",
12115 #endif
12116  .namespaceZero = true,
12117  .padding = offsetof(UA_QueryFirstRequest, maxReferencesToReturn) - offsetof(UA_QueryFirstRequest, maxDataSetsToReturn) - sizeof(UA_UInt32),
12118  .isArray = false
12119  },};
12121 
12122 /* Boolean */
12123 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 1},
12124  .typeIndex = UA_TYPES_BOOLEAN,
12125 #ifdef UA_ENABLE_TYPENAMES
12126  .typeName = "Boolean",
12127 #endif
12128  .memSize = sizeof(UA_Boolean),
12129  .builtin = true,
12130  .fixedSize = true,
12131  .overlayable = true,
12132  .binaryEncodingId = 0,
12133  .membersSize = 1,
12134  .members = Boolean_members },
12135 
12136 /* SByte */
12137 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 2},
12138  .typeIndex = UA_TYPES_SBYTE,
12139 #ifdef UA_ENABLE_TYPENAMES
12140  .typeName = "SByte",
12141 #endif
12142  .memSize = sizeof(UA_SByte),
12143  .builtin = true,
12144  .fixedSize = true,
12145  .overlayable = true,
12146  .binaryEncodingId = 0,
12147  .membersSize = 1,
12148  .members = SByte_members },
12149 
12150 /* Byte */
12151 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 3},
12152  .typeIndex = UA_TYPES_BYTE,
12153 #ifdef UA_ENABLE_TYPENAMES
12154  .typeName = "Byte",
12155 #endif
12156  .memSize = sizeof(UA_Byte),
12157  .builtin = true,
12158  .fixedSize = true,
12159  .overlayable = true,
12160  .binaryEncodingId = 0,
12161  .membersSize = 1,
12162  .members = Byte_members },
12163 
12164 /* Int16 */
12165 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 4},
12166  .typeIndex = UA_TYPES_INT16,
12167 #ifdef UA_ENABLE_TYPENAMES
12168  .typeName = "Int16",
12169 #endif
12170  .memSize = sizeof(UA_Int16),
12171  .builtin = true,
12172  .fixedSize = true,
12173  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12174  .binaryEncodingId = 0,
12175  .membersSize = 1,
12176  .members = Int16_members },
12177 
12178 /* UInt16 */
12179 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 5},
12180  .typeIndex = UA_TYPES_UINT16,
12181 #ifdef UA_ENABLE_TYPENAMES
12182  .typeName = "UInt16",
12183 #endif
12184  .memSize = sizeof(UA_UInt16),
12185  .builtin = true,
12186  .fixedSize = true,
12187  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12188  .binaryEncodingId = 0,
12189  .membersSize = 1,
12190  .members = UInt16_members },
12191 
12192 /* Int32 */
12193 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12194  .typeIndex = UA_TYPES_INT32,
12195 #ifdef UA_ENABLE_TYPENAMES
12196  .typeName = "Int32",
12197 #endif
12198  .memSize = sizeof(UA_Int32),
12199  .builtin = true,
12200  .fixedSize = true,
12201  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12202  .binaryEncodingId = 0,
12203  .membersSize = 1,
12204  .members = Int32_members },
12205 
12206 /* UInt32 */
12207 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 7},
12208  .typeIndex = UA_TYPES_UINT32,
12209 #ifdef UA_ENABLE_TYPENAMES
12210  .typeName = "UInt32",
12211 #endif
12212  .memSize = sizeof(UA_UInt32),
12213  .builtin = true,
12214  .fixedSize = true,
12215  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12216  .binaryEncodingId = 0,
12217  .membersSize = 1,
12218  .members = UInt32_members },
12219 
12220 /* Int64 */
12221 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 8},
12222  .typeIndex = UA_TYPES_INT64,
12223 #ifdef UA_ENABLE_TYPENAMES
12224  .typeName = "Int64",
12225 #endif
12226  .memSize = sizeof(UA_Int64),
12227  .builtin = true,
12228  .fixedSize = true,
12229  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12230  .binaryEncodingId = 0,
12231  .membersSize = 1,
12232  .members = Int64_members },
12233 
12234 /* UInt64 */
12235 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 9},
12236  .typeIndex = UA_TYPES_UINT64,
12237 #ifdef UA_ENABLE_TYPENAMES
12238  .typeName = "UInt64",
12239 #endif
12240  .memSize = sizeof(UA_UInt64),
12241  .builtin = true,
12242  .fixedSize = true,
12243  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12244  .binaryEncodingId = 0,
12245  .membersSize = 1,
12246  .members = UInt64_members },
12247 
12248 /* Float */
12249 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 10},
12250  .typeIndex = UA_TYPES_FLOAT,
12251 #ifdef UA_ENABLE_TYPENAMES
12252  .typeName = "Float",
12253 #endif
12254  .memSize = sizeof(UA_Float),
12255  .builtin = true,
12256  .fixedSize = true,
12257  .overlayable = UA_BINARY_OVERLAYABLE_FLOAT,
12258  .binaryEncodingId = 0,
12259  .membersSize = 1,
12260  .members = Float_members },
12261 
12262 /* Double */
12263 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 11},
12264  .typeIndex = UA_TYPES_DOUBLE,
12265 #ifdef UA_ENABLE_TYPENAMES
12266  .typeName = "Double",
12267 #endif
12268  .memSize = sizeof(UA_Double),
12269  .builtin = true,
12270  .fixedSize = true,
12271  .overlayable = UA_BINARY_OVERLAYABLE_FLOAT,
12272  .binaryEncodingId = 0,
12273  .membersSize = 1,
12274  .members = Double_members },
12275 
12276 /* String */
12277 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 12},
12278  .typeIndex = UA_TYPES_STRING,
12279 #ifdef UA_ENABLE_TYPENAMES
12280  .typeName = "String",
12281 #endif
12282  .memSize = sizeof(UA_String),
12283  .builtin = true,
12284  .fixedSize = false,
12285  .overlayable = false,
12286  .binaryEncodingId = 0,
12287  .membersSize = 1,
12288  .members = String_members },
12289 
12290 /* DateTime */
12291 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 13},
12292  .typeIndex = UA_TYPES_DATETIME,
12293 #ifdef UA_ENABLE_TYPENAMES
12294  .typeName = "DateTime",
12295 #endif
12296  .memSize = sizeof(UA_DateTime),
12297  .builtin = true,
12298  .fixedSize = true,
12299  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12300  .binaryEncodingId = 0,
12301  .membersSize = 1,
12302  .members = DateTime_members },
12303 
12304 /* Guid */
12305 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 14},
12306  .typeIndex = UA_TYPES_GUID,
12307 #ifdef UA_ENABLE_TYPENAMES
12308  .typeName = "Guid",
12309 #endif
12310  .memSize = sizeof(UA_Guid),
12311  .builtin = true,
12312  .fixedSize = true,
12313  .overlayable = (UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_Guid, data2) == sizeof(UA_UInt32) && offsetof(UA_Guid, data3) == (sizeof(UA_UInt16) + sizeof(UA_UInt32)) && offsetof(UA_Guid, data4) == (2*sizeof(UA_UInt32))),
12314  .binaryEncodingId = 0,
12315  .membersSize = 1,
12316  .members = Guid_members },
12317 
12318 /* ByteString */
12319 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 15},
12320  .typeIndex = UA_TYPES_BYTESTRING,
12321 #ifdef UA_ENABLE_TYPENAMES
12322  .typeName = "ByteString",
12323 #endif
12324  .memSize = sizeof(UA_ByteString),
12325  .builtin = true,
12326  .fixedSize = false,
12327  .overlayable = false,
12328  .binaryEncodingId = 0,
12329  .membersSize = 1,
12330  .members = ByteString_members },
12331 
12332 /* XmlElement */
12333 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 16},
12334  .typeIndex = UA_TYPES_XMLELEMENT,
12335 #ifdef UA_ENABLE_TYPENAMES
12336  .typeName = "XmlElement",
12337 #endif
12338  .memSize = sizeof(UA_XmlElement),
12339  .builtin = true,
12340  .fixedSize = false,
12341  .overlayable = false,
12342  .binaryEncodingId = 0,
12343  .membersSize = 1,
12344  .members = XmlElement_members },
12345 
12346 /* NodeId */
12347 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 17},
12348  .typeIndex = UA_TYPES_NODEID,
12349 #ifdef UA_ENABLE_TYPENAMES
12350  .typeName = "NodeId",
12351 #endif
12352  .memSize = sizeof(UA_NodeId),
12353  .builtin = true,
12354  .fixedSize = false,
12355  .overlayable = false,
12356  .binaryEncodingId = 0,
12357  .membersSize = 1,
12358  .members = NodeId_members },
12359 
12360 /* ExpandedNodeId */
12361 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 18},
12362  .typeIndex = UA_TYPES_EXPANDEDNODEID,
12363 #ifdef UA_ENABLE_TYPENAMES
12364  .typeName = "ExpandedNodeId",
12365 #endif
12366  .memSize = sizeof(UA_ExpandedNodeId),
12367  .builtin = true,
12368  .fixedSize = false,
12369  .overlayable = false,
12370  .binaryEncodingId = 0,
12371  .membersSize = 1,
12372  .members = ExpandedNodeId_members },
12373 
12374 /* StatusCode */
12375 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 19},
12376  .typeIndex = UA_TYPES_STATUSCODE,
12377 #ifdef UA_ENABLE_TYPENAMES
12378  .typeName = "StatusCode",
12379 #endif
12380  .memSize = sizeof(UA_StatusCode),
12381  .builtin = true,
12382  .fixedSize = true,
12383  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12384  .binaryEncodingId = 0,
12385  .membersSize = 1,
12386  .members = StatusCode_members },
12387 
12388 /* QualifiedName */
12389 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 20},
12390  .typeIndex = UA_TYPES_QUALIFIEDNAME,
12391 #ifdef UA_ENABLE_TYPENAMES
12392  .typeName = "QualifiedName",
12393 #endif
12394  .memSize = sizeof(UA_QualifiedName),
12395  .builtin = true,
12396  .fixedSize = false,
12397  .overlayable = false,
12398  .binaryEncodingId = 0,
12399  .membersSize = 2,
12400  .members = QualifiedName_members },
12401 
12402 /* LocalizedText */
12403 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 21},
12404  .typeIndex = UA_TYPES_LOCALIZEDTEXT,
12405 #ifdef UA_ENABLE_TYPENAMES
12406  .typeName = "LocalizedText",
12407 #endif
12408  .memSize = sizeof(UA_LocalizedText),
12409  .builtin = true,
12410  .fixedSize = false,
12411  .overlayable = false,
12412  .binaryEncodingId = 0,
12413  .membersSize = 1,
12414  .members = LocalizedText_members },
12415 
12416 /* ExtensionObject */
12417 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 22},
12418  .typeIndex = UA_TYPES_EXTENSIONOBJECT,
12419 #ifdef UA_ENABLE_TYPENAMES
12420  .typeName = "ExtensionObject",
12421 #endif
12422  .memSize = sizeof(UA_ExtensionObject),
12423  .builtin = true,
12424  .fixedSize = false,
12425  .overlayable = false,
12426  .binaryEncodingId = 0,
12427  .membersSize = 1,
12428  .members = ExtensionObject_members },
12429 
12430 /* DataValue */
12431 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 23},
12432  .typeIndex = UA_TYPES_DATAVALUE,
12433 #ifdef UA_ENABLE_TYPENAMES
12434  .typeName = "DataValue",
12435 #endif
12436  .memSize = sizeof(UA_DataValue),
12437  .builtin = true,
12438  .fixedSize = false,
12439  .overlayable = false,
12440  .binaryEncodingId = 0,
12441  .membersSize = 1,
12442  .members = DataValue_members },
12443 
12444 /* Variant */
12445 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 24},
12446  .typeIndex = UA_TYPES_VARIANT,
12447 #ifdef UA_ENABLE_TYPENAMES
12448  .typeName = "Variant",
12449 #endif
12450  .memSize = sizeof(UA_Variant),
12451  .builtin = true,
12452  .fixedSize = false,
12453  .overlayable = false,
12454  .binaryEncodingId = 0,
12455  .membersSize = 1,
12456  .members = Variant_members },
12457 
12458 /* DiagnosticInfo */
12459 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 25},
12460  .typeIndex = UA_TYPES_DIAGNOSTICINFO,
12461 #ifdef UA_ENABLE_TYPENAMES
12462  .typeName = "DiagnosticInfo",
12463 #endif
12464  .memSize = sizeof(UA_DiagnosticInfo),
12465  .builtin = true,
12466  .fixedSize = false,
12467  .overlayable = false,
12468  .binaryEncodingId = 0,
12469  .membersSize = 1,
12470  .members = DiagnosticInfo_members },
12471 
12472 /* SignedSoftwareCertificate */
12473 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 344},
12475 #ifdef UA_ENABLE_TYPENAMES
12476  .typeName = "SignedSoftwareCertificate",
12477 #endif
12478  .memSize = sizeof(UA_SignedSoftwareCertificate),
12479  .builtin = false,
12480  .fixedSize = false,
12481  .overlayable = false,
12482  .binaryEncodingId = 346,
12483  .membersSize = 2,
12484  .members = SignedSoftwareCertificate_members },
12485 
12486 /* BrowsePathTarget */
12487 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 546},
12488  .typeIndex = UA_TYPES_BROWSEPATHTARGET,
12489 #ifdef UA_ENABLE_TYPENAMES
12490  .typeName = "BrowsePathTarget",
12491 #endif
12492  .memSize = sizeof(UA_BrowsePathTarget),
12493  .builtin = false,
12494  .fixedSize = false,
12495  .overlayable = false,
12496  .binaryEncodingId = 548,
12497  .membersSize = 2,
12498  .members = BrowsePathTarget_members },
12499 
12500 /* ViewAttributes */
12501 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 373},
12502  .typeIndex = UA_TYPES_VIEWATTRIBUTES,
12503 #ifdef UA_ENABLE_TYPENAMES
12504  .typeName = "ViewAttributes",
12505 #endif
12506  .memSize = sizeof(UA_ViewAttributes),
12507  .builtin = false,
12508  .fixedSize = false,
12509  .overlayable = false,
12510  .binaryEncodingId = 375,
12511  .membersSize = 7,
12512  .members = ViewAttributes_members },
12513 
12514 /* BrowseResultMask */
12515 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12516  .typeIndex = UA_TYPES_INT32,
12517 #ifdef UA_ENABLE_TYPENAMES
12518  .typeName = "BrowseResultMask",
12519 #endif
12520  .memSize = sizeof(UA_BrowseResultMask),
12521  .builtin = true,
12522  .fixedSize = true,
12523  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12524  .binaryEncodingId = 0,
12525  .membersSize = 1,
12526  .members = BrowseResultMask_members },
12527 
12528 /* RequestHeader */
12529 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 389},
12530  .typeIndex = UA_TYPES_REQUESTHEADER,
12531 #ifdef UA_ENABLE_TYPENAMES
12532  .typeName = "RequestHeader",
12533 #endif
12534  .memSize = sizeof(UA_RequestHeader),
12535  .builtin = false,
12536  .fixedSize = false,
12537  .overlayable = false,
12538  .binaryEncodingId = 391,
12539  .membersSize = 7,
12540  .members = RequestHeader_members },
12541 
12542 /* MonitoredItemModifyResult */
12543 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 758},
12545 #ifdef UA_ENABLE_TYPENAMES
12546  .typeName = "MonitoredItemModifyResult",
12547 #endif
12548  .memSize = sizeof(UA_MonitoredItemModifyResult),
12549  .builtin = false,
12550  .fixedSize = false,
12551  .overlayable = false,
12552  .binaryEncodingId = 760,
12553  .membersSize = 4,
12554  .members = MonitoredItemModifyResult_members },
12555 
12556 /* CloseSecureChannelRequest */
12557 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 450},
12559 #ifdef UA_ENABLE_TYPENAMES
12560  .typeName = "CloseSecureChannelRequest",
12561 #endif
12562  .memSize = sizeof(UA_CloseSecureChannelRequest),
12563  .builtin = false,
12564  .fixedSize = false,
12565  .overlayable = false,
12566  .binaryEncodingId = 452,
12567  .membersSize = 1,
12568  .members = CloseSecureChannelRequest_members },
12569 
12570 /* AddNodesResult */
12571 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 483},
12572  .typeIndex = UA_TYPES_ADDNODESRESULT,
12573 #ifdef UA_ENABLE_TYPENAMES
12574  .typeName = "AddNodesResult",
12575 #endif
12576  .memSize = sizeof(UA_AddNodesResult),
12577  .builtin = false,
12578  .fixedSize = false,
12579  .overlayable = false,
12580  .binaryEncodingId = 485,
12581  .membersSize = 2,
12582  .members = AddNodesResult_members },
12583 
12584 /* VariableAttributes */
12585 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 355},
12586  .typeIndex = UA_TYPES_VARIABLEATTRIBUTES,
12587 #ifdef UA_ENABLE_TYPENAMES
12588  .typeName = "VariableAttributes",
12589 #endif
12590  .memSize = sizeof(UA_VariableAttributes),
12591  .builtin = false,
12592  .fixedSize = false,
12593  .overlayable = false,
12594  .binaryEncodingId = 357,
12595  .membersSize = 13,
12596  .members = VariableAttributes_members },
12597 
12598 /* NotificationMessage */
12599 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 803},
12600  .typeIndex = UA_TYPES_NOTIFICATIONMESSAGE,
12601 #ifdef UA_ENABLE_TYPENAMES
12602  .typeName = "NotificationMessage",
12603 #endif
12604  .memSize = sizeof(UA_NotificationMessage),
12605  .builtin = false,
12606  .fixedSize = false,
12607  .overlayable = false,
12608  .binaryEncodingId = 805,
12609  .membersSize = 3,
12610  .members = NotificationMessage_members },
12611 
12612 /* NodeAttributesMask */
12613 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12614  .typeIndex = UA_TYPES_INT32,
12615 #ifdef UA_ENABLE_TYPENAMES
12616  .typeName = "NodeAttributesMask",
12617 #endif
12618  .memSize = sizeof(UA_NodeAttributesMask),
12619  .builtin = true,
12620  .fixedSize = true,
12621  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12622  .binaryEncodingId = 0,
12623  .membersSize = 1,
12624  .members = NodeAttributesMask_members },
12625 
12626 /* MonitoringMode */
12627 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12628  .typeIndex = UA_TYPES_INT32,
12629 #ifdef UA_ENABLE_TYPENAMES
12630  .typeName = "MonitoringMode",
12631 #endif
12632  .memSize = sizeof(UA_MonitoringMode),
12633  .builtin = true,
12634  .fixedSize = true,
12635  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12636  .binaryEncodingId = 0,
12637  .membersSize = 1,
12638  .members = MonitoringMode_members },
12639 
12640 /* CallMethodResult */
12641 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 707},
12642  .typeIndex = UA_TYPES_CALLMETHODRESULT,
12643 #ifdef UA_ENABLE_TYPENAMES
12644  .typeName = "CallMethodResult",
12645 #endif
12646  .memSize = sizeof(UA_CallMethodResult),
12647  .builtin = false,
12648  .fixedSize = false,
12649  .overlayable = false,
12650  .binaryEncodingId = 709,
12651  .membersSize = 4,
12652  .members = CallMethodResult_members },
12653 
12654 /* ParsingResult */
12655 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 610},
12656  .typeIndex = UA_TYPES_PARSINGRESULT,
12657 #ifdef UA_ENABLE_TYPENAMES
12658  .typeName = "ParsingResult",
12659 #endif
12660  .memSize = sizeof(UA_ParsingResult),
12661  .builtin = false,
12662  .fixedSize = false,
12663  .overlayable = false,
12664  .binaryEncodingId = 612,
12665  .membersSize = 3,
12666  .members = ParsingResult_members },
12667 
12668 /* RelativePathElement */
12669 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 537},
12670  .typeIndex = UA_TYPES_RELATIVEPATHELEMENT,
12671 #ifdef UA_ENABLE_TYPENAMES
12672  .typeName = "RelativePathElement",
12673 #endif
12674  .memSize = sizeof(UA_RelativePathElement),
12675  .builtin = false,
12676  .fixedSize = false,
12677  .overlayable = false,
12678  .binaryEncodingId = 539,
12679  .membersSize = 4,
12680  .members = RelativePathElement_members },
12681 
12682 /* BrowseDirection */
12683 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12684  .typeIndex = UA_TYPES_INT32,
12685 #ifdef UA_ENABLE_TYPENAMES
12686  .typeName = "BrowseDirection",
12687 #endif
12688  .memSize = sizeof(UA_BrowseDirection),
12689  .builtin = true,
12690  .fixedSize = true,
12691  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12692  .binaryEncodingId = 0,
12693  .membersSize = 1,
12694  .members = BrowseDirection_members },
12695 
12696 /* CallMethodRequest */
12697 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 704},
12698  .typeIndex = UA_TYPES_CALLMETHODREQUEST,
12699 #ifdef UA_ENABLE_TYPENAMES
12700  .typeName = "CallMethodRequest",
12701 #endif
12702  .memSize = sizeof(UA_CallMethodRequest),
12703  .builtin = false,
12704  .fixedSize = false,
12705  .overlayable = false,
12706  .binaryEncodingId = 706,
12707  .membersSize = 3,
12708  .members = CallMethodRequest_members },
12709 
12710 /* UnregisterNodesRequest */
12711 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 564},
12712  .typeIndex = UA_TYPES_UNREGISTERNODESREQUEST,
12713 #ifdef UA_ENABLE_TYPENAMES
12714  .typeName = "UnregisterNodesRequest",
12715 #endif
12716  .memSize = sizeof(UA_UnregisterNodesRequest),
12717  .builtin = false,
12718  .fixedSize = false,
12719  .overlayable = false,
12720  .binaryEncodingId = 566,
12721  .membersSize = 2,
12722  .members = UnregisterNodesRequest_members },
12723 
12724 /* ContentFilterElementResult */
12725 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 604},
12727 #ifdef UA_ENABLE_TYPENAMES
12728  .typeName = "ContentFilterElementResult",
12729 #endif
12730  .memSize = sizeof(UA_ContentFilterElementResult),
12731  .builtin = false,
12732  .fixedSize = false,
12733  .overlayable = false,
12734  .binaryEncodingId = 606,
12735  .membersSize = 3,
12736  .members = ContentFilterElementResult_members },
12737 
12738 /* QueryDataSet */
12739 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 577},
12740  .typeIndex = UA_TYPES_QUERYDATASET,
12741 #ifdef UA_ENABLE_TYPENAMES
12742  .typeName = "QueryDataSet",
12743 #endif
12744  .memSize = sizeof(UA_QueryDataSet),
12745  .builtin = false,
12746  .fixedSize = false,
12747  .overlayable = false,
12748  .binaryEncodingId = 579,
12749  .membersSize = 3,
12750  .members = QueryDataSet_members },
12751 
12752 /* AnonymousIdentityToken */
12753 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 319},
12754  .typeIndex = UA_TYPES_ANONYMOUSIDENTITYTOKEN,
12755 #ifdef UA_ENABLE_TYPENAMES
12756  .typeName = "AnonymousIdentityToken",
12757 #endif
12758  .memSize = sizeof(UA_AnonymousIdentityToken),
12759  .builtin = false,
12760  .fixedSize = false,
12761  .overlayable = false,
12762  .binaryEncodingId = 321,
12763  .membersSize = 1,
12764  .members = AnonymousIdentityToken_members },
12765 
12766 /* SetPublishingModeRequest */
12767 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 797},
12768  .typeIndex = UA_TYPES_SETPUBLISHINGMODEREQUEST,
12769 #ifdef UA_ENABLE_TYPENAMES
12770  .typeName = "SetPublishingModeRequest",
12771 #endif
12772  .memSize = sizeof(UA_SetPublishingModeRequest),
12773  .builtin = false,
12774  .fixedSize = false,
12775  .overlayable = false,
12776  .binaryEncodingId = 799,
12777  .membersSize = 3,
12778  .members = SetPublishingModeRequest_members },
12779 
12780 /* TimestampsToReturn */
12781 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12782  .typeIndex = UA_TYPES_INT32,
12783 #ifdef UA_ENABLE_TYPENAMES
12784  .typeName = "TimestampsToReturn",
12785 #endif
12786  .memSize = sizeof(UA_TimestampsToReturn),
12787  .builtin = true,
12788  .fixedSize = true,
12789  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12790  .binaryEncodingId = 0,
12791  .membersSize = 1,
12792  .members = TimestampsToReturn_members },
12793 
12794 /* CallRequest */
12795 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 710},
12796  .typeIndex = UA_TYPES_CALLREQUEST,
12797 #ifdef UA_ENABLE_TYPENAMES
12798  .typeName = "CallRequest",
12799 #endif
12800  .memSize = sizeof(UA_CallRequest),
12801  .builtin = false,
12802  .fixedSize = false,
12803  .overlayable = false,
12804  .binaryEncodingId = 712,
12805  .membersSize = 2,
12806  .members = CallRequest_members },
12807 
12808 /* MethodAttributes */
12809 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 358},
12810  .typeIndex = UA_TYPES_METHODATTRIBUTES,
12811 #ifdef UA_ENABLE_TYPENAMES
12812  .typeName = "MethodAttributes",
12813 #endif
12814  .memSize = sizeof(UA_MethodAttributes),
12815  .builtin = false,
12816  .fixedSize = false,
12817  .overlayable = false,
12818  .binaryEncodingId = 360,
12819  .membersSize = 7,
12820  .members = MethodAttributes_members },
12821 
12822 /* DeleteReferencesItem */
12823 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 385},
12824  .typeIndex = UA_TYPES_DELETEREFERENCESITEM,
12825 #ifdef UA_ENABLE_TYPENAMES
12826  .typeName = "DeleteReferencesItem",
12827 #endif
12828  .memSize = sizeof(UA_DeleteReferencesItem),
12829  .builtin = false,
12830  .fixedSize = false,
12831  .overlayable = false,
12832  .binaryEncodingId = 387,
12833  .membersSize = 5,
12834  .members = DeleteReferencesItem_members },
12835 
12836 /* WriteValue */
12837 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 668},
12838  .typeIndex = UA_TYPES_WRITEVALUE,
12839 #ifdef UA_ENABLE_TYPENAMES
12840  .typeName = "WriteValue",
12841 #endif
12842  .memSize = sizeof(UA_WriteValue),
12843  .builtin = false,
12844  .fixedSize = false,
12845  .overlayable = false,
12846  .binaryEncodingId = 670,
12847  .membersSize = 4,
12848  .members = WriteValue_members },
12849 
12850 /* MonitoredItemCreateResult */
12851 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 746},
12853 #ifdef UA_ENABLE_TYPENAMES
12854  .typeName = "MonitoredItemCreateResult",
12855 #endif
12856  .memSize = sizeof(UA_MonitoredItemCreateResult),
12857  .builtin = false,
12858  .fixedSize = false,
12859  .overlayable = false,
12860  .binaryEncodingId = 748,
12861  .membersSize = 5,
12862  .members = MonitoredItemCreateResult_members },
12863 
12864 /* MessageSecurityMode */
12865 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12866  .typeIndex = UA_TYPES_INT32,
12867 #ifdef UA_ENABLE_TYPENAMES
12868  .typeName = "MessageSecurityMode",
12869 #endif
12870  .memSize = sizeof(UA_MessageSecurityMode),
12871  .builtin = true,
12872  .fixedSize = true,
12873  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12874  .binaryEncodingId = 0,
12875  .membersSize = 1,
12876  .members = MessageSecurityMode_members },
12877 
12878 /* MonitoringParameters */
12879 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 740},
12880  .typeIndex = UA_TYPES_MONITORINGPARAMETERS,
12881 #ifdef UA_ENABLE_TYPENAMES
12882  .typeName = "MonitoringParameters",
12883 #endif
12884  .memSize = sizeof(UA_MonitoringParameters),
12885  .builtin = false,
12886  .fixedSize = false,
12887  .overlayable = false,
12888  .binaryEncodingId = 742,
12889  .membersSize = 5,
12890  .members = MonitoringParameters_members },
12891 
12892 /* SignatureData */
12893 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 456},
12894  .typeIndex = UA_TYPES_SIGNATUREDATA,
12895 #ifdef UA_ENABLE_TYPENAMES
12896  .typeName = "SignatureData",
12897 #endif
12898  .memSize = sizeof(UA_SignatureData),
12899  .builtin = false,
12900  .fixedSize = false,
12901  .overlayable = false,
12902  .binaryEncodingId = 458,
12903  .membersSize = 2,
12904  .members = SignatureData_members },
12905 
12906 /* ReferenceNode */
12907 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 285},
12908  .typeIndex = UA_TYPES_REFERENCENODE,
12909 #ifdef UA_ENABLE_TYPENAMES
12910  .typeName = "ReferenceNode",
12911 #endif
12912  .memSize = sizeof(UA_ReferenceNode),
12913  .builtin = false,
12914  .fixedSize = false,
12915  .overlayable = false,
12916  .binaryEncodingId = 287,
12917  .membersSize = 3,
12918  .members = ReferenceNode_members },
12919 
12920 /* Argument */
12921 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 296},
12922  .typeIndex = UA_TYPES_ARGUMENT,
12923 #ifdef UA_ENABLE_TYPENAMES
12924  .typeName = "Argument",
12925 #endif
12926  .memSize = sizeof(UA_Argument),
12927  .builtin = false,
12928  .fixedSize = false,
12929  .overlayable = false,
12930  .binaryEncodingId = 298,
12931  .membersSize = 5,
12932  .members = Argument_members },
12933 
12934 /* UserIdentityToken */
12935 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 316},
12936  .typeIndex = UA_TYPES_USERIDENTITYTOKEN,
12937 #ifdef UA_ENABLE_TYPENAMES
12938  .typeName = "UserIdentityToken",
12939 #endif
12940  .memSize = sizeof(UA_UserIdentityToken),
12941  .builtin = false,
12942  .fixedSize = false,
12943  .overlayable = false,
12944  .binaryEncodingId = 318,
12945  .membersSize = 1,
12946  .members = UserIdentityToken_members },
12947 
12948 /* ObjectTypeAttributes */
12949 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 361},
12950  .typeIndex = UA_TYPES_OBJECTTYPEATTRIBUTES,
12951 #ifdef UA_ENABLE_TYPENAMES
12952  .typeName = "ObjectTypeAttributes",
12953 #endif
12954  .memSize = sizeof(UA_ObjectTypeAttributes),
12955  .builtin = false,
12956  .fixedSize = false,
12957  .overlayable = false,
12958  .binaryEncodingId = 363,
12959  .membersSize = 6,
12960  .members = ObjectTypeAttributes_members },
12961 
12962 /* DeadbandType */
12963 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12964  .typeIndex = UA_TYPES_INT32,
12965 #ifdef UA_ENABLE_TYPENAMES
12966  .typeName = "DeadbandType",
12967 #endif
12968  .memSize = sizeof(UA_DeadbandType),
12969  .builtin = true,
12970  .fixedSize = true,
12971  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12972  .binaryEncodingId = 0,
12973  .membersSize = 1,
12974  .members = DeadbandType_members },
12975 
12976 /* SecurityTokenRequestType */
12977 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12978  .typeIndex = UA_TYPES_INT32,
12979 #ifdef UA_ENABLE_TYPENAMES
12980  .typeName = "SecurityTokenRequestType",
12981 #endif
12982  .memSize = sizeof(UA_SecurityTokenRequestType),
12983  .builtin = true,
12984  .fixedSize = true,
12985  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
12986  .binaryEncodingId = 0,
12987  .membersSize = 1,
12988  .members = SecurityTokenRequestType_members },
12989 
12990 /* DataChangeTrigger */
12991 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
12992  .typeIndex = UA_TYPES_INT32,
12993 #ifdef UA_ENABLE_TYPENAMES
12994  .typeName = "DataChangeTrigger",
12995 #endif
12996  .memSize = sizeof(UA_DataChangeTrigger),
12997  .builtin = true,
12998  .fixedSize = true,
12999  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13000  .binaryEncodingId = 0,
13001  .membersSize = 1,
13002  .members = DataChangeTrigger_members },
13003 
13004 /* BuildInfo */
13005 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 338},
13006  .typeIndex = UA_TYPES_BUILDINFO,
13007 #ifdef UA_ENABLE_TYPENAMES
13008  .typeName = "BuildInfo",
13009 #endif
13010  .memSize = sizeof(UA_BuildInfo),
13011  .builtin = false,
13012  .fixedSize = false,
13013  .overlayable = false,
13014  .binaryEncodingId = 340,
13015  .membersSize = 6,
13016  .members = BuildInfo_members },
13017 
13018 /* NodeClass */
13019 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13020  .typeIndex = UA_TYPES_INT32,
13021 #ifdef UA_ENABLE_TYPENAMES
13022  .typeName = "NodeClass",
13023 #endif
13024  .memSize = sizeof(UA_NodeClass),
13025  .builtin = true,
13026  .fixedSize = true,
13027  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13028  .binaryEncodingId = 0,
13029  .membersSize = 1,
13030  .members = NodeClass_members },
13031 
13032 /* ChannelSecurityToken */
13033 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 441},
13034  .typeIndex = UA_TYPES_CHANNELSECURITYTOKEN,
13035 #ifdef UA_ENABLE_TYPENAMES
13036  .typeName = "ChannelSecurityToken",
13037 #endif
13038  .memSize = sizeof(UA_ChannelSecurityToken),
13039  .builtin = false,
13040  .fixedSize = true,
13041  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_ChannelSecurityToken, tokenId) == (offsetof(UA_ChannelSecurityToken, channelId) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_ChannelSecurityToken, createdAt) == (offsetof(UA_ChannelSecurityToken, tokenId) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_ChannelSecurityToken, revisedLifetime) == (offsetof(UA_ChannelSecurityToken, createdAt) + sizeof(UA_DateTime)),
13042  .binaryEncodingId = 443,
13043  .membersSize = 4,
13044  .members = ChannelSecurityToken_members },
13045 
13046 /* MonitoredItemNotification */
13047 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 806},
13049 #ifdef UA_ENABLE_TYPENAMES
13050  .typeName = "MonitoredItemNotification",
13051 #endif
13052  .memSize = sizeof(UA_MonitoredItemNotification),
13053  .builtin = false,
13054  .fixedSize = false,
13055  .overlayable = false,
13056  .binaryEncodingId = 808,
13057  .membersSize = 2,
13058  .members = MonitoredItemNotification_members },
13059 
13060 /* DeleteNodesItem */
13061 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 382},
13062  .typeIndex = UA_TYPES_DELETENODESITEM,
13063 #ifdef UA_ENABLE_TYPENAMES
13064  .typeName = "DeleteNodesItem",
13065 #endif
13066  .memSize = sizeof(UA_DeleteNodesItem),
13067  .builtin = false,
13068  .fixedSize = false,
13069  .overlayable = false,
13070  .binaryEncodingId = 384,
13071  .membersSize = 2,
13072  .members = DeleteNodesItem_members },
13073 
13074 /* SubscriptionAcknowledgement */
13075 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 821},
13077 #ifdef UA_ENABLE_TYPENAMES
13078  .typeName = "SubscriptionAcknowledgement",
13079 #endif
13080  .memSize = sizeof(UA_SubscriptionAcknowledgement),
13081  .builtin = false,
13082  .fixedSize = true,
13083  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_SubscriptionAcknowledgement, sequenceNumber) == (offsetof(UA_SubscriptionAcknowledgement, subscriptionId) + sizeof(UA_UInt32)),
13084  .binaryEncodingId = 823,
13085  .membersSize = 2,
13086  .members = SubscriptionAcknowledgement_members },
13087 
13088 /* ReadValueId */
13089 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 626},
13090  .typeIndex = UA_TYPES_READVALUEID,
13091 #ifdef UA_ENABLE_TYPENAMES
13092  .typeName = "ReadValueId",
13093 #endif
13094  .memSize = sizeof(UA_ReadValueId),
13095  .builtin = false,
13096  .fixedSize = false,
13097  .overlayable = false,
13098  .binaryEncodingId = 628,
13099  .membersSize = 4,
13100  .members = ReadValueId_members },
13101 
13102 /* DataTypeAttributes */
13103 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 370},
13104  .typeIndex = UA_TYPES_DATATYPEATTRIBUTES,
13105 #ifdef UA_ENABLE_TYPENAMES
13106  .typeName = "DataTypeAttributes",
13107 #endif
13108  .memSize = sizeof(UA_DataTypeAttributes),
13109  .builtin = false,
13110  .fixedSize = false,
13111  .overlayable = false,
13112  .binaryEncodingId = 372,
13113  .membersSize = 6,
13114  .members = DataTypeAttributes_members },
13115 
13116 /* ResponseHeader */
13117 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 392},
13118  .typeIndex = UA_TYPES_RESPONSEHEADER,
13119 #ifdef UA_ENABLE_TYPENAMES
13120  .typeName = "ResponseHeader",
13121 #endif
13122  .memSize = sizeof(UA_ResponseHeader),
13123  .builtin = false,
13124  .fixedSize = false,
13125  .overlayable = false,
13126  .binaryEncodingId = 394,
13127  .membersSize = 6,
13128  .members = ResponseHeader_members },
13129 
13130 /* DeleteSubscriptionsRequest */
13131 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 845},
13133 #ifdef UA_ENABLE_TYPENAMES
13134  .typeName = "DeleteSubscriptionsRequest",
13135 #endif
13136  .memSize = sizeof(UA_DeleteSubscriptionsRequest),
13137  .builtin = false,
13138  .fixedSize = false,
13139  .overlayable = false,
13140  .binaryEncodingId = 847,
13141  .membersSize = 2,
13142  .members = DeleteSubscriptionsRequest_members },
13143 
13144 /* ViewDescription */
13145 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 511},
13146  .typeIndex = UA_TYPES_VIEWDESCRIPTION,
13147 #ifdef UA_ENABLE_TYPENAMES
13148  .typeName = "ViewDescription",
13149 #endif
13150  .memSize = sizeof(UA_ViewDescription),
13151  .builtin = false,
13152  .fixedSize = false,
13153  .overlayable = false,
13154  .binaryEncodingId = 513,
13155  .membersSize = 3,
13156  .members = ViewDescription_members },
13157 
13158 /* DeleteMonitoredItemsResponse */
13159 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 782},
13161 #ifdef UA_ENABLE_TYPENAMES
13162  .typeName = "DeleteMonitoredItemsResponse",
13163 #endif
13164  .memSize = sizeof(UA_DeleteMonitoredItemsResponse),
13165  .builtin = false,
13166  .fixedSize = false,
13167  .overlayable = false,
13168  .binaryEncodingId = 784,
13169  .membersSize = 3,
13170  .members = DeleteMonitoredItemsResponse_members },
13171 
13172 /* NodeAttributes */
13173 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 349},
13174  .typeIndex = UA_TYPES_NODEATTRIBUTES,
13175 #ifdef UA_ENABLE_TYPENAMES
13176  .typeName = "NodeAttributes",
13177 #endif
13178  .memSize = sizeof(UA_NodeAttributes),
13179  .builtin = false,
13180  .fixedSize = false,
13181  .overlayable = false,
13182  .binaryEncodingId = 351,
13183  .membersSize = 5,
13184  .members = NodeAttributes_members },
13185 
13186 /* RegisterNodesRequest */
13187 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 558},
13188  .typeIndex = UA_TYPES_REGISTERNODESREQUEST,
13189 #ifdef UA_ENABLE_TYPENAMES
13190  .typeName = "RegisterNodesRequest",
13191 #endif
13192  .memSize = sizeof(UA_RegisterNodesRequest),
13193  .builtin = false,
13194  .fixedSize = false,
13195  .overlayable = false,
13196  .binaryEncodingId = 560,
13197  .membersSize = 2,
13198  .members = RegisterNodesRequest_members },
13199 
13200 /* DeleteNodesRequest */
13201 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 498},
13202  .typeIndex = UA_TYPES_DELETENODESREQUEST,
13203 #ifdef UA_ENABLE_TYPENAMES
13204  .typeName = "DeleteNodesRequest",
13205 #endif
13206  .memSize = sizeof(UA_DeleteNodesRequest),
13207  .builtin = false,
13208  .fixedSize = false,
13209  .overlayable = false,
13210  .binaryEncodingId = 500,
13211  .membersSize = 2,
13212  .members = DeleteNodesRequest_members },
13213 
13214 /* PublishResponse */
13215 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 827},
13216  .typeIndex = UA_TYPES_PUBLISHRESPONSE,
13217 #ifdef UA_ENABLE_TYPENAMES
13218  .typeName = "PublishResponse",
13219 #endif
13220  .memSize = sizeof(UA_PublishResponse),
13221  .builtin = false,
13222  .fixedSize = false,
13223  .overlayable = false,
13224  .binaryEncodingId = 829,
13225  .membersSize = 7,
13226  .members = PublishResponse_members },
13227 
13228 /* MonitoredItemModifyRequest */
13229 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 755},
13231 #ifdef UA_ENABLE_TYPENAMES
13232  .typeName = "MonitoredItemModifyRequest",
13233 #endif
13234  .memSize = sizeof(UA_MonitoredItemModifyRequest),
13235  .builtin = false,
13236  .fixedSize = false,
13237  .overlayable = false,
13238  .binaryEncodingId = 757,
13239  .membersSize = 2,
13240  .members = MonitoredItemModifyRequest_members },
13241 
13242 /* UserNameIdentityToken */
13243 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 322},
13244  .typeIndex = UA_TYPES_USERNAMEIDENTITYTOKEN,
13245 #ifdef UA_ENABLE_TYPENAMES
13246  .typeName = "UserNameIdentityToken",
13247 #endif
13248  .memSize = sizeof(UA_UserNameIdentityToken),
13249  .builtin = false,
13250  .fixedSize = false,
13251  .overlayable = false,
13252  .binaryEncodingId = 324,
13253  .membersSize = 4,
13254  .members = UserNameIdentityToken_members },
13255 
13256 /* IdType */
13257 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13258  .typeIndex = UA_TYPES_INT32,
13259 #ifdef UA_ENABLE_TYPENAMES
13260  .typeName = "IdType",
13261 #endif
13262  .memSize = sizeof(UA_IdType),
13263  .builtin = true,
13264  .fixedSize = true,
13265  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13266  .binaryEncodingId = 0,
13267  .membersSize = 1,
13268  .members = IdType_members },
13269 
13270 /* UserTokenType */
13271 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13272  .typeIndex = UA_TYPES_INT32,
13273 #ifdef UA_ENABLE_TYPENAMES
13274  .typeName = "UserTokenType",
13275 #endif
13276  .memSize = sizeof(UA_UserTokenType),
13277  .builtin = true,
13278  .fixedSize = true,
13279  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13280  .binaryEncodingId = 0,
13281  .membersSize = 1,
13282  .members = UserTokenType_members },
13283 
13284 /* ActivateSessionRequest */
13285 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 465},
13286  .typeIndex = UA_TYPES_ACTIVATESESSIONREQUEST,
13287 #ifdef UA_ENABLE_TYPENAMES
13288  .typeName = "ActivateSessionRequest",
13289 #endif
13290  .memSize = sizeof(UA_ActivateSessionRequest),
13291  .builtin = false,
13292  .fixedSize = false,
13293  .overlayable = false,
13294  .binaryEncodingId = 467,
13295  .membersSize = 6,
13296  .members = ActivateSessionRequest_members },
13297 
13298 /* OpenSecureChannelResponse */
13299 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 447},
13301 #ifdef UA_ENABLE_TYPENAMES
13302  .typeName = "OpenSecureChannelResponse",
13303 #endif
13304  .memSize = sizeof(UA_OpenSecureChannelResponse),
13305  .builtin = false,
13306  .fixedSize = false,
13307  .overlayable = false,
13308  .binaryEncodingId = 449,
13309  .membersSize = 4,
13310  .members = OpenSecureChannelResponse_members },
13311 
13312 /* ApplicationType */
13313 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13314  .typeIndex = UA_TYPES_INT32,
13315 #ifdef UA_ENABLE_TYPENAMES
13316  .typeName = "ApplicationType",
13317 #endif
13318  .memSize = sizeof(UA_ApplicationType),
13319  .builtin = true,
13320  .fixedSize = true,
13321  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13322  .binaryEncodingId = 0,
13323  .membersSize = 1,
13324  .members = ApplicationType_members },
13325 
13326 /* ServerState */
13327 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13328  .typeIndex = UA_TYPES_INT32,
13329 #ifdef UA_ENABLE_TYPENAMES
13330  .typeName = "ServerState",
13331 #endif
13332  .memSize = sizeof(UA_ServerState),
13333  .builtin = true,
13334  .fixedSize = true,
13335  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13336  .binaryEncodingId = 0,
13337  .membersSize = 1,
13338  .members = ServerState_members },
13339 
13340 /* QueryNextResponse */
13341 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 622},
13342  .typeIndex = UA_TYPES_QUERYNEXTRESPONSE,
13343 #ifdef UA_ENABLE_TYPENAMES
13344  .typeName = "QueryNextResponse",
13345 #endif
13346  .memSize = sizeof(UA_QueryNextResponse),
13347  .builtin = false,
13348  .fixedSize = false,
13349  .overlayable = false,
13350  .binaryEncodingId = 624,
13351  .membersSize = 3,
13352  .members = QueryNextResponse_members },
13353 
13354 /* ActivateSessionResponse */
13355 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 468},
13356  .typeIndex = UA_TYPES_ACTIVATESESSIONRESPONSE,
13357 #ifdef UA_ENABLE_TYPENAMES
13358  .typeName = "ActivateSessionResponse",
13359 #endif
13360  .memSize = sizeof(UA_ActivateSessionResponse),
13361  .builtin = false,
13362  .fixedSize = false,
13363  .overlayable = false,
13364  .binaryEncodingId = 470,
13365  .membersSize = 4,
13366  .members = ActivateSessionResponse_members },
13367 
13368 /* FilterOperator */
13369 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 6},
13370  .typeIndex = UA_TYPES_INT32,
13371 #ifdef UA_ENABLE_TYPENAMES
13372  .typeName = "FilterOperator",
13373 #endif
13374  .memSize = sizeof(UA_FilterOperator),
13375  .builtin = true,
13376  .fixedSize = true,
13377  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
13378  .binaryEncodingId = 0,
13379  .membersSize = 1,
13380  .members = FilterOperator_members },
13381 
13382 /* QueryNextRequest */
13383 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 619},
13384  .typeIndex = UA_TYPES_QUERYNEXTREQUEST,
13385 #ifdef UA_ENABLE_TYPENAMES
13386  .typeName = "QueryNextRequest",
13387 #endif
13388  .memSize = sizeof(UA_QueryNextRequest),
13389  .builtin = false,
13390  .fixedSize = false,
13391  .overlayable = false,
13392  .binaryEncodingId = 621,
13393  .membersSize = 3,
13394  .members = QueryNextRequest_members },
13395 
13396 /* WriteResponse */
13397 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 674},
13398  .typeIndex = UA_TYPES_WRITERESPONSE,
13399 #ifdef UA_ENABLE_TYPENAMES
13400  .typeName = "WriteResponse",
13401 #endif
13402  .memSize = sizeof(UA_WriteResponse),
13403  .builtin = false,
13404  .fixedSize = false,
13405  .overlayable = false,
13406  .binaryEncodingId = 676,
13407  .membersSize = 3,
13408  .members = WriteResponse_members },
13409 
13410 /* BrowseNextRequest */
13411 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 531},
13412  .typeIndex = UA_TYPES_BROWSENEXTREQUEST,
13413 #ifdef UA_ENABLE_TYPENAMES
13414  .typeName = "BrowseNextRequest",
13415 #endif
13416  .memSize = sizeof(UA_BrowseNextRequest),
13417  .builtin = false,
13418  .fixedSize = false,
13419  .overlayable = false,
13420  .binaryEncodingId = 533,
13421  .membersSize = 3,
13422  .members = BrowseNextRequest_members },
13423 
13424 /* CreateSubscriptionRequest */
13425 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 785},
13427 #ifdef UA_ENABLE_TYPENAMES
13428  .typeName = "CreateSubscriptionRequest",
13429 #endif
13430  .memSize = sizeof(UA_CreateSubscriptionRequest),
13431  .builtin = false,
13432  .fixedSize = false,
13433  .overlayable = false,
13434  .binaryEncodingId = 787,
13435  .membersSize = 7,
13436  .members = CreateSubscriptionRequest_members },
13437 
13438 /* VariableTypeAttributes */
13439 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 364},
13440  .typeIndex = UA_TYPES_VARIABLETYPEATTRIBUTES,
13441 #ifdef UA_ENABLE_TYPENAMES
13442  .typeName = "VariableTypeAttributes",
13443 #endif
13444  .memSize = sizeof(UA_VariableTypeAttributes),
13445  .builtin = false,
13446  .fixedSize = false,
13447  .overlayable = false,
13448  .binaryEncodingId = 366,
13449  .membersSize = 10,
13450  .members = VariableTypeAttributes_members },
13451 
13452 /* BrowsePathResult */
13453 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 549},
13454  .typeIndex = UA_TYPES_BROWSEPATHRESULT,
13455 #ifdef UA_ENABLE_TYPENAMES
13456  .typeName = "BrowsePathResult",
13457 #endif
13458  .memSize = sizeof(UA_BrowsePathResult),
13459  .builtin = false,
13460  .fixedSize = false,
13461  .overlayable = false,
13462  .binaryEncodingId = 551,
13463  .membersSize = 2,
13464  .members = BrowsePathResult_members },
13465 
13466 /* ModifySubscriptionResponse */
13467 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 794},
13469 #ifdef UA_ENABLE_TYPENAMES
13470  .typeName = "ModifySubscriptionResponse",
13471 #endif
13472  .memSize = sizeof(UA_ModifySubscriptionResponse),
13473  .builtin = false,
13474  .fixedSize = false,
13475  .overlayable = false,
13476  .binaryEncodingId = 796,
13477  .membersSize = 4,
13478  .members = ModifySubscriptionResponse_members },
13479 
13480 /* OpenSecureChannelRequest */
13481 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 444},
13482  .typeIndex = UA_TYPES_OPENSECURECHANNELREQUEST,
13483 #ifdef UA_ENABLE_TYPENAMES
13484  .typeName = "OpenSecureChannelRequest",
13485 #endif
13486  .memSize = sizeof(UA_OpenSecureChannelRequest),
13487  .builtin = false,
13488  .fixedSize = false,
13489  .overlayable = false,
13490  .binaryEncodingId = 446,
13491  .membersSize = 6,
13492  .members = OpenSecureChannelRequest_members },
13493 
13494 /* RegisterNodesResponse */
13495 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 561},
13496  .typeIndex = UA_TYPES_REGISTERNODESRESPONSE,
13497 #ifdef UA_ENABLE_TYPENAMES
13498  .typeName = "RegisterNodesResponse",
13499 #endif
13500  .memSize = sizeof(UA_RegisterNodesResponse),
13501  .builtin = false,
13502  .fixedSize = false,
13503  .overlayable = false,
13504  .binaryEncodingId = 563,
13505  .membersSize = 2,
13506  .members = RegisterNodesResponse_members },
13507 
13508 /* CloseSessionRequest */
13509 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 471},
13510  .typeIndex = UA_TYPES_CLOSESESSIONREQUEST,
13511 #ifdef UA_ENABLE_TYPENAMES
13512  .typeName = "CloseSessionRequest",
13513 #endif
13514  .memSize = sizeof(UA_CloseSessionRequest),
13515  .builtin = false,
13516  .fixedSize = false,
13517  .overlayable = false,
13518  .binaryEncodingId = 473,
13519  .membersSize = 2,
13520  .members = CloseSessionRequest_members },
13521 
13522 /* ModifySubscriptionRequest */
13523 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 791},
13525 #ifdef UA_ENABLE_TYPENAMES
13526  .typeName = "ModifySubscriptionRequest",
13527 #endif
13528  .memSize = sizeof(UA_ModifySubscriptionRequest),
13529  .builtin = false,
13530  .fixedSize = false,
13531  .overlayable = false,
13532  .binaryEncodingId = 793,
13533  .membersSize = 7,
13534  .members = ModifySubscriptionRequest_members },
13535 
13536 /* UserTokenPolicy */
13537 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 304},
13538  .typeIndex = UA_TYPES_USERTOKENPOLICY,
13539 #ifdef UA_ENABLE_TYPENAMES
13540  .typeName = "UserTokenPolicy",
13541 #endif
13542  .memSize = sizeof(UA_UserTokenPolicy),
13543  .builtin = false,
13544  .fixedSize = false,
13545  .overlayable = false,
13546  .binaryEncodingId = 306,
13547  .membersSize = 5,
13548  .members = UserTokenPolicy_members },
13549 
13550 /* DeleteMonitoredItemsRequest */
13551 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 779},
13553 #ifdef UA_ENABLE_TYPENAMES
13554  .typeName = "DeleteMonitoredItemsRequest",
13555 #endif
13556  .memSize = sizeof(UA_DeleteMonitoredItemsRequest),
13557  .builtin = false,
13558  .fixedSize = false,
13559  .overlayable = false,
13560  .binaryEncodingId = 781,
13561  .membersSize = 3,
13562  .members = DeleteMonitoredItemsRequest_members },
13563 
13564 /* ReferenceTypeAttributes */
13565 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 367},
13566  .typeIndex = UA_TYPES_REFERENCETYPEATTRIBUTES,
13567 #ifdef UA_ENABLE_TYPENAMES
13568  .typeName = "ReferenceTypeAttributes",
13569 #endif
13570  .memSize = sizeof(UA_ReferenceTypeAttributes),
13571  .builtin = false,
13572  .fixedSize = false,
13573  .overlayable = false,
13574  .binaryEncodingId = 369,
13575  .membersSize = 8,
13576  .members = ReferenceTypeAttributes_members },
13577 
13578 /* SetMonitoringModeRequest */
13579 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 767},
13580  .typeIndex = UA_TYPES_SETMONITORINGMODEREQUEST,
13581 #ifdef UA_ENABLE_TYPENAMES
13582  .typeName = "SetMonitoringModeRequest",
13583 #endif
13584  .memSize = sizeof(UA_SetMonitoringModeRequest),
13585  .builtin = false,
13586  .fixedSize = false,
13587  .overlayable = false,
13588  .binaryEncodingId = 769,
13589  .membersSize = 4,
13590  .members = SetMonitoringModeRequest_members },
13591 
13592 /* UnregisterNodesResponse */
13593 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 567},
13594  .typeIndex = UA_TYPES_UNREGISTERNODESRESPONSE,
13595 #ifdef UA_ENABLE_TYPENAMES
13596  .typeName = "UnregisterNodesResponse",
13597 #endif
13598  .memSize = sizeof(UA_UnregisterNodesResponse),
13599  .builtin = false,
13600  .fixedSize = false,
13601  .overlayable = false,
13602  .binaryEncodingId = 569,
13603  .membersSize = 1,
13604  .members = UnregisterNodesResponse_members },
13605 
13606 /* WriteRequest */
13607 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 671},
13608  .typeIndex = UA_TYPES_WRITEREQUEST,
13609 #ifdef UA_ENABLE_TYPENAMES
13610  .typeName = "WriteRequest",
13611 #endif
13612  .memSize = sizeof(UA_WriteRequest),
13613  .builtin = false,
13614  .fixedSize = false,
13615  .overlayable = false,
13616  .binaryEncodingId = 673,
13617  .membersSize = 2,
13618  .members = WriteRequest_members },
13619 
13620 /* ObjectAttributes */
13621 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 352},
13622  .typeIndex = UA_TYPES_OBJECTATTRIBUTES,
13623 #ifdef UA_ENABLE_TYPENAMES
13624  .typeName = "ObjectAttributes",
13625 #endif
13626  .memSize = sizeof(UA_ObjectAttributes),
13627  .builtin = false,
13628  .fixedSize = false,
13629  .overlayable = false,
13630  .binaryEncodingId = 354,
13631  .membersSize = 6,
13632  .members = ObjectAttributes_members },
13633 
13634 /* BrowseDescription */
13635 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 514},
13636  .typeIndex = UA_TYPES_BROWSEDESCRIPTION,
13637 #ifdef UA_ENABLE_TYPENAMES
13638  .typeName = "BrowseDescription",
13639 #endif
13640  .memSize = sizeof(UA_BrowseDescription),
13641  .builtin = false,
13642  .fixedSize = false,
13643  .overlayable = false,
13644  .binaryEncodingId = 516,
13645  .membersSize = 6,
13646  .members = BrowseDescription_members },
13647 
13648 /* RepublishRequest */
13649 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 830},
13650  .typeIndex = UA_TYPES_REPUBLISHREQUEST,
13651 #ifdef UA_ENABLE_TYPENAMES
13652  .typeName = "RepublishRequest",
13653 #endif
13654  .memSize = sizeof(UA_RepublishRequest),
13655  .builtin = false,
13656  .fixedSize = false,
13657  .overlayable = false,
13658  .binaryEncodingId = 832,
13659  .membersSize = 3,
13660  .members = RepublishRequest_members },
13661 
13662 /* GetEndpointsRequest */
13663 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 426},
13664  .typeIndex = UA_TYPES_GETENDPOINTSREQUEST,
13665 #ifdef UA_ENABLE_TYPENAMES
13666  .typeName = "GetEndpointsRequest",
13667 #endif
13668  .memSize = sizeof(UA_GetEndpointsRequest),
13669  .builtin = false,
13670  .fixedSize = false,
13671  .overlayable = false,
13672  .binaryEncodingId = 428,
13673  .membersSize = 4,
13674  .members = GetEndpointsRequest_members },
13675 
13676 /* PublishRequest */
13677 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 824},
13678  .typeIndex = UA_TYPES_PUBLISHREQUEST,
13679 #ifdef UA_ENABLE_TYPENAMES
13680  .typeName = "PublishRequest",
13681 #endif
13682  .memSize = sizeof(UA_PublishRequest),
13683  .builtin = false,
13684  .fixedSize = false,
13685  .overlayable = false,
13686  .binaryEncodingId = 826,
13687  .membersSize = 2,
13688  .members = PublishRequest_members },
13689 
13690 /* AddNodesResponse */
13691 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 489},
13692  .typeIndex = UA_TYPES_ADDNODESRESPONSE,
13693 #ifdef UA_ENABLE_TYPENAMES
13694  .typeName = "AddNodesResponse",
13695 #endif
13696  .memSize = sizeof(UA_AddNodesResponse),
13697  .builtin = false,
13698  .fixedSize = false,
13699  .overlayable = false,
13700  .binaryEncodingId = 491,
13701  .membersSize = 3,
13702  .members = AddNodesResponse_members },
13703 
13704 /* DataChangeNotification */
13705 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 809},
13706  .typeIndex = UA_TYPES_DATACHANGENOTIFICATION,
13707 #ifdef UA_ENABLE_TYPENAMES
13708  .typeName = "DataChangeNotification",
13709 #endif
13710  .memSize = sizeof(UA_DataChangeNotification),
13711  .builtin = false,
13712  .fixedSize = false,
13713  .overlayable = false,
13714  .binaryEncodingId = 811,
13715  .membersSize = 2,
13716  .members = DataChangeNotification_members },
13717 
13718 /* CloseSecureChannelResponse */
13719 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 453},
13721 #ifdef UA_ENABLE_TYPENAMES
13722  .typeName = "CloseSecureChannelResponse",
13723 #endif
13724  .memSize = sizeof(UA_CloseSecureChannelResponse),
13725  .builtin = false,
13726  .fixedSize = false,
13727  .overlayable = false,
13728  .binaryEncodingId = 455,
13729  .membersSize = 1,
13730  .members = CloseSecureChannelResponse_members },
13731 
13732 /* ModifyMonitoredItemsRequest */
13733 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 761},
13735 #ifdef UA_ENABLE_TYPENAMES
13736  .typeName = "ModifyMonitoredItemsRequest",
13737 #endif
13738  .memSize = sizeof(UA_ModifyMonitoredItemsRequest),
13739  .builtin = false,
13740  .fixedSize = false,
13741  .overlayable = false,
13742  .binaryEncodingId = 763,
13743  .membersSize = 4,
13744  .members = ModifyMonitoredItemsRequest_members },
13745 
13746 /* SetMonitoringModeResponse */
13747 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 770},
13749 #ifdef UA_ENABLE_TYPENAMES
13750  .typeName = "SetMonitoringModeResponse",
13751 #endif
13752  .memSize = sizeof(UA_SetMonitoringModeResponse),
13753  .builtin = false,
13754  .fixedSize = false,
13755  .overlayable = false,
13756  .binaryEncodingId = 772,
13757  .membersSize = 3,
13758  .members = SetMonitoringModeResponse_members },
13759 
13760 /* FindServersRequest */
13761 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 420},
13762  .typeIndex = UA_TYPES_FINDSERVERSREQUEST,
13763 #ifdef UA_ENABLE_TYPENAMES
13764  .typeName = "FindServersRequest",
13765 #endif
13766  .memSize = sizeof(UA_FindServersRequest),
13767  .builtin = false,
13768  .fixedSize = false,
13769  .overlayable = false,
13770  .binaryEncodingId = 422,
13771  .membersSize = 4,
13772  .members = FindServersRequest_members },
13773 
13774 /* ReferenceDescription */
13775 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 518},
13776  .typeIndex = UA_TYPES_REFERENCEDESCRIPTION,
13777 #ifdef UA_ENABLE_TYPENAMES
13778  .typeName = "ReferenceDescription",
13779 #endif
13780  .memSize = sizeof(UA_ReferenceDescription),
13781  .builtin = false,
13782  .fixedSize = false,
13783  .overlayable = false,
13784  .binaryEncodingId = 520,
13785  .membersSize = 7,
13786  .members = ReferenceDescription_members },
13787 
13788 /* SetPublishingModeResponse */
13789 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 800},
13791 #ifdef UA_ENABLE_TYPENAMES
13792  .typeName = "SetPublishingModeResponse",
13793 #endif
13794  .memSize = sizeof(UA_SetPublishingModeResponse),
13795  .builtin = false,
13796  .fixedSize = false,
13797  .overlayable = false,
13798  .binaryEncodingId = 802,
13799  .membersSize = 3,
13800  .members = SetPublishingModeResponse_members },
13801 
13802 /* ContentFilterResult */
13803 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 607},
13804  .typeIndex = UA_TYPES_CONTENTFILTERRESULT,
13805 #ifdef UA_ENABLE_TYPENAMES
13806  .typeName = "ContentFilterResult",
13807 #endif
13808  .memSize = sizeof(UA_ContentFilterResult),
13809  .builtin = false,
13810  .fixedSize = false,
13811  .overlayable = false,
13812  .binaryEncodingId = 609,
13813  .membersSize = 2,
13814  .members = ContentFilterResult_members },
13815 
13816 /* AddReferencesItem */
13817 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 379},
13818  .typeIndex = UA_TYPES_ADDREFERENCESITEM,
13819 #ifdef UA_ENABLE_TYPENAMES
13820  .typeName = "AddReferencesItem",
13821 #endif
13822  .memSize = sizeof(UA_AddReferencesItem),
13823  .builtin = false,
13824  .fixedSize = false,
13825  .overlayable = false,
13826  .binaryEncodingId = 381,
13827  .membersSize = 6,
13828  .members = AddReferencesItem_members },
13829 
13830 /* CreateSubscriptionResponse */
13831 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 788},
13833 #ifdef UA_ENABLE_TYPENAMES
13834  .typeName = "CreateSubscriptionResponse",
13835 #endif
13836  .memSize = sizeof(UA_CreateSubscriptionResponse),
13837  .builtin = false,
13838  .fixedSize = false,
13839  .overlayable = false,
13840  .binaryEncodingId = 790,
13841  .membersSize = 5,
13842  .members = CreateSubscriptionResponse_members },
13843 
13844 /* DeleteSubscriptionsResponse */
13845 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 848},
13847 #ifdef UA_ENABLE_TYPENAMES
13848  .typeName = "DeleteSubscriptionsResponse",
13849 #endif
13850  .memSize = sizeof(UA_DeleteSubscriptionsResponse),
13851  .builtin = false,
13852  .fixedSize = false,
13853  .overlayable = false,
13854  .binaryEncodingId = 850,
13855  .membersSize = 3,
13856  .members = DeleteSubscriptionsResponse_members },
13857 
13858 /* RelativePath */
13859 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 540},
13860  .typeIndex = UA_TYPES_RELATIVEPATH,
13861 #ifdef UA_ENABLE_TYPENAMES
13862  .typeName = "RelativePath",
13863 #endif
13864  .memSize = sizeof(UA_RelativePath),
13865  .builtin = false,
13866  .fixedSize = false,
13867  .overlayable = false,
13868  .binaryEncodingId = 542,
13869  .membersSize = 1,
13870  .members = RelativePath_members },
13871 
13872 /* DeleteReferencesResponse */
13873 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 507},
13874  .typeIndex = UA_TYPES_DELETEREFERENCESRESPONSE,
13875 #ifdef UA_ENABLE_TYPENAMES
13876  .typeName = "DeleteReferencesResponse",
13877 #endif
13878  .memSize = sizeof(UA_DeleteReferencesResponse),
13879  .builtin = false,
13880  .fixedSize = false,
13881  .overlayable = false,
13882  .binaryEncodingId = 509,
13883  .membersSize = 3,
13884  .members = DeleteReferencesResponse_members },
13885 
13886 /* CreateMonitoredItemsResponse */
13887 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 752},
13889 #ifdef UA_ENABLE_TYPENAMES
13890  .typeName = "CreateMonitoredItemsResponse",
13891 #endif
13892  .memSize = sizeof(UA_CreateMonitoredItemsResponse),
13893  .builtin = false,
13894  .fixedSize = false,
13895  .overlayable = false,
13896  .binaryEncodingId = 754,
13897  .membersSize = 3,
13898  .members = CreateMonitoredItemsResponse_members },
13899 
13900 /* CallResponse */
13901 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 713},
13902  .typeIndex = UA_TYPES_CALLRESPONSE,
13903 #ifdef UA_ENABLE_TYPENAMES
13904  .typeName = "CallResponse",
13905 #endif
13906  .memSize = sizeof(UA_CallResponse),
13907  .builtin = false,
13908  .fixedSize = false,
13909  .overlayable = false,
13910  .binaryEncodingId = 715,
13911  .membersSize = 3,
13912  .members = CallResponse_members },
13913 
13914 /* DeleteNodesResponse */
13915 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 501},
13916  .typeIndex = UA_TYPES_DELETENODESRESPONSE,
13917 #ifdef UA_ENABLE_TYPENAMES
13918  .typeName = "DeleteNodesResponse",
13919 #endif
13920  .memSize = sizeof(UA_DeleteNodesResponse),
13921  .builtin = false,
13922  .fixedSize = false,
13923  .overlayable = false,
13924  .binaryEncodingId = 503,
13925  .membersSize = 3,
13926  .members = DeleteNodesResponse_members },
13927 
13928 /* RepublishResponse */
13929 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 833},
13930  .typeIndex = UA_TYPES_REPUBLISHRESPONSE,
13931 #ifdef UA_ENABLE_TYPENAMES
13932  .typeName = "RepublishResponse",
13933 #endif
13934  .memSize = sizeof(UA_RepublishResponse),
13935  .builtin = false,
13936  .fixedSize = false,
13937  .overlayable = false,
13938  .binaryEncodingId = 835,
13939  .membersSize = 2,
13940  .members = RepublishResponse_members },
13941 
13942 /* MonitoredItemCreateRequest */
13943 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 743},
13945 #ifdef UA_ENABLE_TYPENAMES
13946  .typeName = "MonitoredItemCreateRequest",
13947 #endif
13948  .memSize = sizeof(UA_MonitoredItemCreateRequest),
13949  .builtin = false,
13950  .fixedSize = false,
13951  .overlayable = false,
13952  .binaryEncodingId = 745,
13953  .membersSize = 3,
13954  .members = MonitoredItemCreateRequest_members },
13955 
13956 /* DeleteReferencesRequest */
13957 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 504},
13958  .typeIndex = UA_TYPES_DELETEREFERENCESREQUEST,
13959 #ifdef UA_ENABLE_TYPENAMES
13960  .typeName = "DeleteReferencesRequest",
13961 #endif
13962  .memSize = sizeof(UA_DeleteReferencesRequest),
13963  .builtin = false,
13964  .fixedSize = false,
13965  .overlayable = false,
13966  .binaryEncodingId = 506,
13967  .membersSize = 2,
13968  .members = DeleteReferencesRequest_members },
13969 
13970 /* ModifyMonitoredItemsResponse */
13971 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 764},
13973 #ifdef UA_ENABLE_TYPENAMES
13974  .typeName = "ModifyMonitoredItemsResponse",
13975 #endif
13976  .memSize = sizeof(UA_ModifyMonitoredItemsResponse),
13977  .builtin = false,
13978  .fixedSize = false,
13979  .overlayable = false,
13980  .binaryEncodingId = 766,
13981  .membersSize = 3,
13982  .members = ModifyMonitoredItemsResponse_members },
13983 
13984 /* ReadResponse */
13985 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 632},
13986  .typeIndex = UA_TYPES_READRESPONSE,
13987 #ifdef UA_ENABLE_TYPENAMES
13988  .typeName = "ReadResponse",
13989 #endif
13990  .memSize = sizeof(UA_ReadResponse),
13991  .builtin = false,
13992  .fixedSize = false,
13993  .overlayable = false,
13994  .binaryEncodingId = 634,
13995  .membersSize = 3,
13996  .members = ReadResponse_members },
13997 
13998 /* AddReferencesRequest */
13999 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 492},
14000  .typeIndex = UA_TYPES_ADDREFERENCESREQUEST,
14001 #ifdef UA_ENABLE_TYPENAMES
14002  .typeName = "AddReferencesRequest",
14003 #endif
14004  .memSize = sizeof(UA_AddReferencesRequest),
14005  .builtin = false,
14006  .fixedSize = false,
14007  .overlayable = false,
14008  .binaryEncodingId = 494,
14009  .membersSize = 2,
14010  .members = AddReferencesRequest_members },
14011 
14012 /* ReadRequest */
14013 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 629},
14014  .typeIndex = UA_TYPES_READREQUEST,
14015 #ifdef UA_ENABLE_TYPENAMES
14016  .typeName = "ReadRequest",
14017 #endif
14018  .memSize = sizeof(UA_ReadRequest),
14019  .builtin = false,
14020  .fixedSize = false,
14021  .overlayable = false,
14022  .binaryEncodingId = 631,
14023  .membersSize = 4,
14024  .members = ReadRequest_members },
14025 
14026 /* AddNodesItem */
14027 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 376},
14028  .typeIndex = UA_TYPES_ADDNODESITEM,
14029 #ifdef UA_ENABLE_TYPENAMES
14030  .typeName = "AddNodesItem",
14031 #endif
14032  .memSize = sizeof(UA_AddNodesItem),
14033  .builtin = false,
14034  .fixedSize = false,
14035  .overlayable = false,
14036  .binaryEncodingId = 378,
14037  .membersSize = 7,
14038  .members = AddNodesItem_members },
14039 
14040 /* ServerStatusDataType */
14041 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 862},
14042  .typeIndex = UA_TYPES_SERVERSTATUSDATATYPE,
14043 #ifdef UA_ENABLE_TYPENAMES
14044  .typeName = "ServerStatusDataType",
14045 #endif
14046  .memSize = sizeof(UA_ServerStatusDataType),
14047  .builtin = false,
14048  .fixedSize = false,
14049  .overlayable = false,
14050  .binaryEncodingId = 864,
14051  .membersSize = 6,
14052  .members = ServerStatusDataType_members },
14053 
14054 /* AddReferencesResponse */
14055 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 495},
14056  .typeIndex = UA_TYPES_ADDREFERENCESRESPONSE,
14057 #ifdef UA_ENABLE_TYPENAMES
14058  .typeName = "AddReferencesResponse",
14059 #endif
14060  .memSize = sizeof(UA_AddReferencesResponse),
14061  .builtin = false,
14062  .fixedSize = false,
14063  .overlayable = false,
14064  .binaryEncodingId = 497,
14065  .membersSize = 3,
14066  .members = AddReferencesResponse_members },
14067 
14068 /* TranslateBrowsePathsToNodeIdsResponse */
14069 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 555},
14071 #ifdef UA_ENABLE_TYPENAMES
14072  .typeName = "TranslateBrowsePathsToNodeIdsResponse",
14073 #endif
14074  .memSize = sizeof(UA_TranslateBrowsePathsToNodeIdsResponse),
14075  .builtin = false,
14076  .fixedSize = false,
14077  .overlayable = false,
14078  .binaryEncodingId = 557,
14079  .membersSize = 3,
14080  .members = TranslateBrowsePathsToNodeIdsResponse_members },
14081 
14082 /* DataChangeFilter */
14083 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 722},
14084  .typeIndex = UA_TYPES_DATACHANGEFILTER,
14085 #ifdef UA_ENABLE_TYPENAMES
14086  .typeName = "DataChangeFilter",
14087 #endif
14088  .memSize = sizeof(UA_DataChangeFilter),
14089  .builtin = false,
14090  .fixedSize = true,
14091  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_DataChangeFilter, deadbandType) == (offsetof(UA_DataChangeFilter, trigger) + sizeof(UA_DataChangeTrigger)) && UA_BINARY_OVERLAYABLE_FLOAT && offsetof(UA_DataChangeFilter, deadbandValue) == (offsetof(UA_DataChangeFilter, deadbandType) + sizeof(UA_UInt32)),
14092  .binaryEncodingId = 724,
14093  .membersSize = 3,
14094  .members = DataChangeFilter_members },
14095 
14096 /* ContentFilterElement */
14097 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 583},
14098  .typeIndex = UA_TYPES_CONTENTFILTERELEMENT,
14099 #ifdef UA_ENABLE_TYPENAMES
14100  .typeName = "ContentFilterElement",
14101 #endif
14102  .memSize = sizeof(UA_ContentFilterElement),
14103  .builtin = false,
14104  .fixedSize = false,
14105  .overlayable = false,
14106  .binaryEncodingId = 585,
14107  .membersSize = 2,
14108  .members = ContentFilterElement_members },
14109 
14110 /* CloseSessionResponse */
14111 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 474},
14112  .typeIndex = UA_TYPES_CLOSESESSIONRESPONSE,
14113 #ifdef UA_ENABLE_TYPENAMES
14114  .typeName = "CloseSessionResponse",
14115 #endif
14116  .memSize = sizeof(UA_CloseSessionResponse),
14117  .builtin = false,
14118  .fixedSize = false,
14119  .overlayable = false,
14120  .binaryEncodingId = 476,
14121  .membersSize = 1,
14122  .members = CloseSessionResponse_members },
14123 
14124 /* ApplicationDescription */
14125 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 308},
14126  .typeIndex = UA_TYPES_APPLICATIONDESCRIPTION,
14127 #ifdef UA_ENABLE_TYPENAMES
14128  .typeName = "ApplicationDescription",
14129 #endif
14130  .memSize = sizeof(UA_ApplicationDescription),
14131  .builtin = false,
14132  .fixedSize = false,
14133  .overlayable = false,
14134  .binaryEncodingId = 310,
14135  .membersSize = 7,
14136  .members = ApplicationDescription_members },
14137 
14138 /* ServiceFault */
14139 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 395},
14140  .typeIndex = UA_TYPES_SERVICEFAULT,
14141 #ifdef UA_ENABLE_TYPENAMES
14142  .typeName = "ServiceFault",
14143 #endif
14144  .memSize = sizeof(UA_ServiceFault),
14145  .builtin = false,
14146  .fixedSize = false,
14147  .overlayable = false,
14148  .binaryEncodingId = 397,
14149  .membersSize = 1,
14150  .members = ServiceFault_members },
14151 
14152 /* FindServersResponse */
14153 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 423},
14154  .typeIndex = UA_TYPES_FINDSERVERSRESPONSE,
14155 #ifdef UA_ENABLE_TYPENAMES
14156  .typeName = "FindServersResponse",
14157 #endif
14158  .memSize = sizeof(UA_FindServersResponse),
14159  .builtin = false,
14160  .fixedSize = false,
14161  .overlayable = false,
14162  .binaryEncodingId = 425,
14163  .membersSize = 2,
14164  .members = FindServersResponse_members },
14165 
14166 /* CreateMonitoredItemsRequest */
14167 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 749},
14169 #ifdef UA_ENABLE_TYPENAMES
14170  .typeName = "CreateMonitoredItemsRequest",
14171 #endif
14172  .memSize = sizeof(UA_CreateMonitoredItemsRequest),
14173  .builtin = false,
14174  .fixedSize = false,
14175  .overlayable = false,
14176  .binaryEncodingId = 751,
14177  .membersSize = 4,
14178  .members = CreateMonitoredItemsRequest_members },
14179 
14180 /* ContentFilter */
14181 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 586},
14182  .typeIndex = UA_TYPES_CONTENTFILTER,
14183 #ifdef UA_ENABLE_TYPENAMES
14184  .typeName = "ContentFilter",
14185 #endif
14186  .memSize = sizeof(UA_ContentFilter),
14187  .builtin = false,
14188  .fixedSize = false,
14189  .overlayable = false,
14190  .binaryEncodingId = 588,
14191  .membersSize = 1,
14192  .members = ContentFilter_members },
14193 
14194 /* QueryFirstResponse */
14195 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 616},
14196  .typeIndex = UA_TYPES_QUERYFIRSTRESPONSE,
14197 #ifdef UA_ENABLE_TYPENAMES
14198  .typeName = "QueryFirstResponse",
14199 #endif
14200  .memSize = sizeof(UA_QueryFirstResponse),
14201  .builtin = false,
14202  .fixedSize = false,
14203  .overlayable = false,
14204  .binaryEncodingId = 618,
14205  .membersSize = 6,
14206  .members = QueryFirstResponse_members },
14207 
14208 /* AddNodesRequest */
14209 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 486},
14210  .typeIndex = UA_TYPES_ADDNODESREQUEST,
14211 #ifdef UA_ENABLE_TYPENAMES
14212  .typeName = "AddNodesRequest",
14213 #endif
14214  .memSize = sizeof(UA_AddNodesRequest),
14215  .builtin = false,
14216  .fixedSize = false,
14217  .overlayable = false,
14218  .binaryEncodingId = 488,
14219  .membersSize = 2,
14220  .members = AddNodesRequest_members },
14221 
14222 /* BrowseRequest */
14223 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 525},
14224  .typeIndex = UA_TYPES_BROWSEREQUEST,
14225 #ifdef UA_ENABLE_TYPENAMES
14226  .typeName = "BrowseRequest",
14227 #endif
14228  .memSize = sizeof(UA_BrowseRequest),
14229  .builtin = false,
14230  .fixedSize = false,
14231  .overlayable = false,
14232  .binaryEncodingId = 527,
14233  .membersSize = 4,
14234  .members = BrowseRequest_members },
14235 
14236 /* BrowsePath */
14237 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 543},
14238  .typeIndex = UA_TYPES_BROWSEPATH,
14239 #ifdef UA_ENABLE_TYPENAMES
14240  .typeName = "BrowsePath",
14241 #endif
14242  .memSize = sizeof(UA_BrowsePath),
14243  .builtin = false,
14244  .fixedSize = false,
14245  .overlayable = false,
14246  .binaryEncodingId = 545,
14247  .membersSize = 2,
14248  .members = BrowsePath_members },
14249 
14250 /* BrowseResult */
14251 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 522},
14252  .typeIndex = UA_TYPES_BROWSERESULT,
14253 #ifdef UA_ENABLE_TYPENAMES
14254  .typeName = "BrowseResult",
14255 #endif
14256  .memSize = sizeof(UA_BrowseResult),
14257  .builtin = false,
14258  .fixedSize = false,
14259  .overlayable = false,
14260  .binaryEncodingId = 524,
14261  .membersSize = 3,
14262  .members = BrowseResult_members },
14263 
14264 /* CreateSessionRequest */
14265 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 459},
14266  .typeIndex = UA_TYPES_CREATESESSIONREQUEST,
14267 #ifdef UA_ENABLE_TYPENAMES
14268  .typeName = "CreateSessionRequest",
14269 #endif
14270  .memSize = sizeof(UA_CreateSessionRequest),
14271  .builtin = false,
14272  .fixedSize = false,
14273  .overlayable = false,
14274  .binaryEncodingId = 461,
14275  .membersSize = 9,
14276  .members = CreateSessionRequest_members },
14277 
14278 /* QueryDataDescription */
14279 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 570},
14280  .typeIndex = UA_TYPES_QUERYDATADESCRIPTION,
14281 #ifdef UA_ENABLE_TYPENAMES
14282  .typeName = "QueryDataDescription",
14283 #endif
14284  .memSize = sizeof(UA_QueryDataDescription),
14285  .builtin = false,
14286  .fixedSize = false,
14287  .overlayable = false,
14288  .binaryEncodingId = 572,
14289  .membersSize = 3,
14290  .members = QueryDataDescription_members },
14291 
14292 /* EndpointDescription */
14293 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 312},
14294  .typeIndex = UA_TYPES_ENDPOINTDESCRIPTION,
14295 #ifdef UA_ENABLE_TYPENAMES
14296  .typeName = "EndpointDescription",
14297 #endif
14298  .memSize = sizeof(UA_EndpointDescription),
14299  .builtin = false,
14300  .fixedSize = false,
14301  .overlayable = false,
14302  .binaryEncodingId = 314,
14303  .membersSize = 8,
14304  .members = EndpointDescription_members },
14305 
14306 /* GetEndpointsResponse */
14307 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 429},
14308  .typeIndex = UA_TYPES_GETENDPOINTSRESPONSE,
14309 #ifdef UA_ENABLE_TYPENAMES
14310  .typeName = "GetEndpointsResponse",
14311 #endif
14312  .memSize = sizeof(UA_GetEndpointsResponse),
14313  .builtin = false,
14314  .fixedSize = false,
14315  .overlayable = false,
14316  .binaryEncodingId = 431,
14317  .membersSize = 2,
14318  .members = GetEndpointsResponse_members },
14319 
14320 /* NodeTypeDescription */
14321 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 573},
14322  .typeIndex = UA_TYPES_NODETYPEDESCRIPTION,
14323 #ifdef UA_ENABLE_TYPENAMES
14324  .typeName = "NodeTypeDescription",
14325 #endif
14326  .memSize = sizeof(UA_NodeTypeDescription),
14327  .builtin = false,
14328  .fixedSize = false,
14329  .overlayable = false,
14330  .binaryEncodingId = 575,
14331  .membersSize = 3,
14332  .members = NodeTypeDescription_members },
14333 
14334 /* BrowseNextResponse */
14335 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 534},
14336  .typeIndex = UA_TYPES_BROWSENEXTRESPONSE,
14337 #ifdef UA_ENABLE_TYPENAMES
14338  .typeName = "BrowseNextResponse",
14339 #endif
14340  .memSize = sizeof(UA_BrowseNextResponse),
14341  .builtin = false,
14342  .fixedSize = false,
14343  .overlayable = false,
14344  .binaryEncodingId = 536,
14345  .membersSize = 3,
14346  .members = BrowseNextResponse_members },
14347 
14348 /* TranslateBrowsePathsToNodeIdsRequest */
14349 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 552},
14351 #ifdef UA_ENABLE_TYPENAMES
14352  .typeName = "TranslateBrowsePathsToNodeIdsRequest",
14353 #endif
14354  .memSize = sizeof(UA_TranslateBrowsePathsToNodeIdsRequest),
14355  .builtin = false,
14356  .fixedSize = false,
14357  .overlayable = false,
14358  .binaryEncodingId = 554,
14359  .membersSize = 2,
14360  .members = TranslateBrowsePathsToNodeIdsRequest_members },
14361 
14362 /* BrowseResponse */
14363 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 528},
14364  .typeIndex = UA_TYPES_BROWSERESPONSE,
14365 #ifdef UA_ENABLE_TYPENAMES
14366  .typeName = "BrowseResponse",
14367 #endif
14368  .memSize = sizeof(UA_BrowseResponse),
14369  .builtin = false,
14370  .fixedSize = false,
14371  .overlayable = false,
14372  .binaryEncodingId = 530,
14373  .membersSize = 3,
14374  .members = BrowseResponse_members },
14375 
14376 /* CreateSessionResponse */
14377 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 462},
14378  .typeIndex = UA_TYPES_CREATESESSIONRESPONSE,
14379 #ifdef UA_ENABLE_TYPENAMES
14380  .typeName = "CreateSessionResponse",
14381 #endif
14382  .memSize = sizeof(UA_CreateSessionResponse),
14383  .builtin = false,
14384  .fixedSize = false,
14385  .overlayable = false,
14386  .binaryEncodingId = 464,
14387  .membersSize = 10,
14388  .members = CreateSessionResponse_members },
14389 
14390 /* QueryFirstRequest */
14391 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 613},
14392  .typeIndex = UA_TYPES_QUERYFIRSTREQUEST,
14393 #ifdef UA_ENABLE_TYPENAMES
14394  .typeName = "QueryFirstRequest",
14395 #endif
14396  .memSize = sizeof(UA_QueryFirstRequest),
14397  .builtin = false,
14398  .fixedSize = false,
14399  .overlayable = false,
14400  .binaryEncodingId = 615,
14401  .membersSize = 6,
14402  .members = QueryFirstRequest_members },
14403 };
14404 
14405 
14406 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_transport_generated.c" ***********************************/
14407 
14408 /* Generated from Opc.Ua.Types.bsd, Custom.Opc.Ua.Transport.bsd with script /home/iosb/sw/open62541/tools/generate_datatypes.py
14409  * on host iosb-VirtualBox by user iosb at 2018-08-29 05:32:08 */
14410 
14411 
14412 /* SecureConversationMessageAbortBody */
14413 static UA_DataTypeMember SecureConversationMessageAbortBody_members[2] = {
14415 #ifdef UA_ENABLE_TYPENAMES
14416  .memberName = "error",
14417 #endif
14418  .namespaceZero = true,
14419  .padding = 0,
14420  .isArray = false
14421  },
14422  { .memberTypeIndex = UA_TYPES_STRING,
14423 #ifdef UA_ENABLE_TYPENAMES
14424  .memberName = "reason",
14425 #endif
14426  .namespaceZero = true,
14427  .padding = offsetof(UA_SecureConversationMessageAbortBody, reason) - offsetof(UA_SecureConversationMessageAbortBody, error) - sizeof(UA_UInt32),
14428  .isArray = false
14429  },};
14430 
14431 /* SecureConversationMessageFooter */
14432 static UA_DataTypeMember SecureConversationMessageFooter_members[2] = {
14434 #ifdef UA_ENABLE_TYPENAMES
14435  .memberName = "padding",
14436 #endif
14437  .namespaceZero = true,
14438  .padding = 0,
14439  .isArray = true
14440  },
14441  { .memberTypeIndex = UA_TYPES_BYTE,
14442 #ifdef UA_ENABLE_TYPENAMES
14443  .memberName = "signature",
14444 #endif
14445  .namespaceZero = true,
14446  .padding = offsetof(UA_SecureConversationMessageFooter, signature) - offsetof(UA_SecureConversationMessageFooter, padding) - sizeof(void*),
14447  .isArray = false
14448  },};
14449 
14450 /* TcpHelloMessage */
14451 static UA_DataTypeMember TcpHelloMessage_members[6] = {
14453 #ifdef UA_ENABLE_TYPENAMES
14454  .memberName = "protocolVersion",
14455 #endif
14456  .namespaceZero = true,
14457  .padding = 0,
14458  .isArray = false
14459  },
14460  { .memberTypeIndex = UA_TYPES_UINT32,
14461 #ifdef UA_ENABLE_TYPENAMES
14462  .memberName = "receiveBufferSize",
14463 #endif
14464  .namespaceZero = true,
14465  .padding = offsetof(UA_TcpHelloMessage, receiveBufferSize) - offsetof(UA_TcpHelloMessage, protocolVersion) - sizeof(UA_UInt32),
14466  .isArray = false
14467  },
14468  { .memberTypeIndex = UA_TYPES_UINT32,
14469 #ifdef UA_ENABLE_TYPENAMES
14470  .memberName = "sendBufferSize",
14471 #endif
14472  .namespaceZero = true,
14473  .padding = offsetof(UA_TcpHelloMessage, sendBufferSize) - offsetof(UA_TcpHelloMessage, receiveBufferSize) - sizeof(UA_UInt32),
14474  .isArray = false
14475  },
14476  { .memberTypeIndex = UA_TYPES_UINT32,
14477 #ifdef UA_ENABLE_TYPENAMES
14478  .memberName = "maxMessageSize",
14479 #endif
14480  .namespaceZero = true,
14481  .padding = offsetof(UA_TcpHelloMessage, maxMessageSize) - offsetof(UA_TcpHelloMessage, sendBufferSize) - sizeof(UA_UInt32),
14482  .isArray = false
14483  },
14484  { .memberTypeIndex = UA_TYPES_UINT32,
14485 #ifdef UA_ENABLE_TYPENAMES
14486  .memberName = "maxChunkCount",
14487 #endif
14488  .namespaceZero = true,
14489  .padding = offsetof(UA_TcpHelloMessage, maxChunkCount) - offsetof(UA_TcpHelloMessage, maxMessageSize) - sizeof(UA_UInt32),
14490  .isArray = false
14491  },
14492  { .memberTypeIndex = UA_TYPES_STRING,
14493 #ifdef UA_ENABLE_TYPENAMES
14494  .memberName = "endpointUrl",
14495 #endif
14496  .namespaceZero = true,
14497  .padding = offsetof(UA_TcpHelloMessage, endpointUrl) - offsetof(UA_TcpHelloMessage, maxChunkCount) - sizeof(UA_UInt32),
14498  .isArray = false
14499  },};
14500 
14501 /* TcpErrorMessage */
14502 static UA_DataTypeMember TcpErrorMessage_members[2] = {
14504 #ifdef UA_ENABLE_TYPENAMES
14505  .memberName = "error",
14506 #endif
14507  .namespaceZero = true,
14508  .padding = 0,
14509  .isArray = false
14510  },
14511  { .memberTypeIndex = UA_TYPES_STRING,
14512 #ifdef UA_ENABLE_TYPENAMES
14513  .memberName = "reason",
14514 #endif
14515  .namespaceZero = true,
14516  .padding = offsetof(UA_TcpErrorMessage, reason) - offsetof(UA_TcpErrorMessage, error) - sizeof(UA_UInt32),
14517  .isArray = false
14518  },};
14519 
14520 /* MessageType */
14521 static UA_DataTypeMember MessageType_members[1] = {
14523 #ifdef UA_ENABLE_TYPENAMES
14524  .memberName = "",
14525 #endif
14526  .namespaceZero = true,
14527  .padding = 0,
14528  .isArray = false
14529  },};
14530 
14531 /* AsymmetricAlgorithmSecurityHeader */
14532 static UA_DataTypeMember AsymmetricAlgorithmSecurityHeader_members[3] = {
14534 #ifdef UA_ENABLE_TYPENAMES
14535  .memberName = "securityPolicyUri",
14536 #endif
14537  .namespaceZero = true,
14538  .padding = 0,
14539  .isArray = false
14540  },
14541  { .memberTypeIndex = UA_TYPES_BYTESTRING,
14542 #ifdef UA_ENABLE_TYPENAMES
14543  .memberName = "senderCertificate",
14544 #endif
14545  .namespaceZero = true,
14546  .padding = offsetof(UA_AsymmetricAlgorithmSecurityHeader, senderCertificate) - offsetof(UA_AsymmetricAlgorithmSecurityHeader, securityPolicyUri) - sizeof(UA_ByteString),
14547  .isArray = false
14548  },
14549  { .memberTypeIndex = UA_TYPES_BYTESTRING,
14550 #ifdef UA_ENABLE_TYPENAMES
14551  .memberName = "receiverCertificateThumbprint",
14552 #endif
14553  .namespaceZero = true,
14554  .padding = offsetof(UA_AsymmetricAlgorithmSecurityHeader, receiverCertificateThumbprint) - offsetof(UA_AsymmetricAlgorithmSecurityHeader, senderCertificate) - sizeof(UA_ByteString),
14555  .isArray = false
14556  },};
14557 
14558 /* TcpAcknowledgeMessage */
14559 static UA_DataTypeMember TcpAcknowledgeMessage_members[5] = {
14561 #ifdef UA_ENABLE_TYPENAMES
14562  .memberName = "protocolVersion",
14563 #endif
14564  .namespaceZero = true,
14565  .padding = 0,
14566  .isArray = false
14567  },
14568  { .memberTypeIndex = UA_TYPES_UINT32,
14569 #ifdef UA_ENABLE_TYPENAMES
14570  .memberName = "receiveBufferSize",
14571 #endif
14572  .namespaceZero = true,
14573  .padding = offsetof(UA_TcpAcknowledgeMessage, receiveBufferSize) - offsetof(UA_TcpAcknowledgeMessage, protocolVersion) - sizeof(UA_UInt32),
14574  .isArray = false
14575  },
14576  { .memberTypeIndex = UA_TYPES_UINT32,
14577 #ifdef UA_ENABLE_TYPENAMES
14578  .memberName = "sendBufferSize",
14579 #endif
14580  .namespaceZero = true,
14581  .padding = offsetof(UA_TcpAcknowledgeMessage, sendBufferSize) - offsetof(UA_TcpAcknowledgeMessage, receiveBufferSize) - sizeof(UA_UInt32),
14582  .isArray = false
14583  },
14584  { .memberTypeIndex = UA_TYPES_UINT32,
14585 #ifdef UA_ENABLE_TYPENAMES
14586  .memberName = "maxMessageSize",
14587 #endif
14588  .namespaceZero = true,
14589  .padding = offsetof(UA_TcpAcknowledgeMessage, maxMessageSize) - offsetof(UA_TcpAcknowledgeMessage, sendBufferSize) - sizeof(UA_UInt32),
14590  .isArray = false
14591  },
14592  { .memberTypeIndex = UA_TYPES_UINT32,
14593 #ifdef UA_ENABLE_TYPENAMES
14594  .memberName = "maxChunkCount",
14595 #endif
14596  .namespaceZero = true,
14597  .padding = offsetof(UA_TcpAcknowledgeMessage, maxChunkCount) - offsetof(UA_TcpAcknowledgeMessage, maxMessageSize) - sizeof(UA_UInt32),
14598  .isArray = false
14599  },};
14600 
14601 /* SequenceHeader */
14602 static UA_DataTypeMember SequenceHeader_members[2] = {
14604 #ifdef UA_ENABLE_TYPENAMES
14605  .memberName = "sequenceNumber",
14606 #endif
14607  .namespaceZero = true,
14608  .padding = 0,
14609  .isArray = false
14610  },
14611  { .memberTypeIndex = UA_TYPES_UINT32,
14612 #ifdef UA_ENABLE_TYPENAMES
14613  .memberName = "requestId",
14614 #endif
14615  .namespaceZero = true,
14616  .padding = offsetof(UA_SequenceHeader, requestId) - offsetof(UA_SequenceHeader, sequenceNumber) - sizeof(UA_UInt32),
14617  .isArray = false
14618  },};
14619 
14620 /* TcpMessageHeader */
14621 static UA_DataTypeMember TcpMessageHeader_members[2] = {
14623 #ifdef UA_ENABLE_TYPENAMES
14624  .memberName = "messageTypeAndChunkType",
14625 #endif
14626  .namespaceZero = true,
14627  .padding = 0,
14628  .isArray = false
14629  },
14630  { .memberTypeIndex = UA_TYPES_UINT32,
14631 #ifdef UA_ENABLE_TYPENAMES
14632  .memberName = "messageSize",
14633 #endif
14634  .namespaceZero = true,
14635  .padding = offsetof(UA_TcpMessageHeader, messageSize) - offsetof(UA_TcpMessageHeader, messageTypeAndChunkType) - sizeof(UA_UInt32),
14636  .isArray = false
14637  },};
14638 
14639 /* ChunkType */
14640 static UA_DataTypeMember ChunkType_members[1] = {
14642 #ifdef UA_ENABLE_TYPENAMES
14643  .memberName = "",
14644 #endif
14645  .namespaceZero = true,
14646  .padding = 0,
14647  .isArray = false
14648  },};
14649 
14650 /* SymmetricAlgorithmSecurityHeader */
14651 static UA_DataTypeMember SymmetricAlgorithmSecurityHeader_members[1] = {
14653 #ifdef UA_ENABLE_TYPENAMES
14654  .memberName = "tokenId",
14655 #endif
14656  .namespaceZero = true,
14657  .padding = 0,
14658  .isArray = false
14659  },};
14660 
14661 /* SecureConversationMessageHeader */
14662 static UA_DataTypeMember SecureConversationMessageHeader_members[2] = {
14664 #ifdef UA_ENABLE_TYPENAMES
14665  .memberName = "messageHeader",
14666 #endif
14667  .namespaceZero = false,
14668  .padding = 0,
14669  .isArray = false
14670  },
14671  { .memberTypeIndex = UA_TYPES_UINT32,
14672 #ifdef UA_ENABLE_TYPENAMES
14673  .memberName = "secureChannelId",
14674 #endif
14675  .namespaceZero = true,
14676  .padding = offsetof(UA_SecureConversationMessageHeader, secureChannelId) - offsetof(UA_SecureConversationMessageHeader, messageHeader) - sizeof(UA_TcpMessageHeader),
14677  .isArray = false
14678  },};
14679 const UA_DataType UA_TRANSPORT[UA_TRANSPORT_COUNT] = {
14680 
14681 /* SecureConversationMessageAbortBody */
14682 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14684 #ifdef UA_ENABLE_TYPENAMES
14685  .typeName = "SecureConversationMessageAbortBody",
14686 #endif
14687  .memSize = sizeof(UA_SecureConversationMessageAbortBody),
14688  .builtin = false,
14689  .fixedSize = false,
14690  .overlayable = false,
14691  .binaryEncodingId = 0,
14692  .membersSize = 2,
14693  .members = SecureConversationMessageAbortBody_members },
14694 
14695 /* SecureConversationMessageFooter */
14696 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14698 #ifdef UA_ENABLE_TYPENAMES
14699  .typeName = "SecureConversationMessageFooter",
14700 #endif
14701  .memSize = sizeof(UA_SecureConversationMessageFooter),
14702  .builtin = false,
14703  .fixedSize = false,
14704  .overlayable = false,
14705  .binaryEncodingId = 0,
14706  .membersSize = 2,
14707  .members = SecureConversationMessageFooter_members },
14708 
14709 /* TcpHelloMessage */
14710 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14711  .typeIndex = UA_TRANSPORT_TCPHELLOMESSAGE,
14712 #ifdef UA_ENABLE_TYPENAMES
14713  .typeName = "TcpHelloMessage",
14714 #endif
14715  .memSize = sizeof(UA_TcpHelloMessage),
14716  .builtin = false,
14717  .fixedSize = false,
14718  .overlayable = false,
14719  .binaryEncodingId = 0,
14720  .membersSize = 6,
14721  .members = TcpHelloMessage_members },
14722 
14723 /* TcpErrorMessage */
14724 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14725  .typeIndex = UA_TRANSPORT_TCPERRORMESSAGE,
14726 #ifdef UA_ENABLE_TYPENAMES
14727  .typeName = "TcpErrorMessage",
14728 #endif
14729  .memSize = sizeof(UA_TcpErrorMessage),
14730  .builtin = false,
14731  .fixedSize = false,
14732  .overlayable = false,
14733  .binaryEncodingId = 0,
14734  .membersSize = 2,
14735  .members = TcpErrorMessage_members },
14736 
14737 /* MessageType */
14738 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14739  .typeIndex = UA_TYPES_INT32,
14740 #ifdef UA_ENABLE_TYPENAMES
14741  .typeName = "MessageType",
14742 #endif
14743  .memSize = sizeof(UA_MessageType),
14744  .builtin = true,
14745  .fixedSize = true,
14746  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
14747  .binaryEncodingId = 0,
14748  .membersSize = 1,
14749  .members = MessageType_members },
14750 
14751 /* AsymmetricAlgorithmSecurityHeader */
14752 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14754 #ifdef UA_ENABLE_TYPENAMES
14755  .typeName = "AsymmetricAlgorithmSecurityHeader",
14756 #endif
14757  .memSize = sizeof(UA_AsymmetricAlgorithmSecurityHeader),
14758  .builtin = false,
14759  .fixedSize = false,
14760  .overlayable = false,
14761  .binaryEncodingId = 0,
14762  .membersSize = 3,
14763  .members = AsymmetricAlgorithmSecurityHeader_members },
14764 
14765 /* TcpAcknowledgeMessage */
14766 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14768 #ifdef UA_ENABLE_TYPENAMES
14769  .typeName = "TcpAcknowledgeMessage",
14770 #endif
14771  .memSize = sizeof(UA_TcpAcknowledgeMessage),
14772  .builtin = false,
14773  .fixedSize = true,
14774  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpAcknowledgeMessage, receiveBufferSize) == (offsetof(UA_TcpAcknowledgeMessage, protocolVersion) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpAcknowledgeMessage, sendBufferSize) == (offsetof(UA_TcpAcknowledgeMessage, receiveBufferSize) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpAcknowledgeMessage, maxMessageSize) == (offsetof(UA_TcpAcknowledgeMessage, sendBufferSize) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpAcknowledgeMessage, maxChunkCount) == (offsetof(UA_TcpAcknowledgeMessage, maxMessageSize) + sizeof(UA_UInt32)),
14775  .binaryEncodingId = 0,
14776  .membersSize = 5,
14777  .members = TcpAcknowledgeMessage_members },
14778 
14779 /* SequenceHeader */
14780 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14781  .typeIndex = UA_TRANSPORT_SEQUENCEHEADER,
14782 #ifdef UA_ENABLE_TYPENAMES
14783  .typeName = "SequenceHeader",
14784 #endif
14785  .memSize = sizeof(UA_SequenceHeader),
14786  .builtin = false,
14787  .fixedSize = true,
14788  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_SequenceHeader, requestId) == (offsetof(UA_SequenceHeader, sequenceNumber) + sizeof(UA_UInt32)),
14789  .binaryEncodingId = 0,
14790  .membersSize = 2,
14791  .members = SequenceHeader_members },
14792 
14793 /* TcpMessageHeader */
14794 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14795  .typeIndex = UA_TRANSPORT_TCPMESSAGEHEADER,
14796 #ifdef UA_ENABLE_TYPENAMES
14797  .typeName = "TcpMessageHeader",
14798 #endif
14799  .memSize = sizeof(UA_TcpMessageHeader),
14800  .builtin = false,
14801  .fixedSize = true,
14802  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpMessageHeader, messageSize) == (offsetof(UA_TcpMessageHeader, messageTypeAndChunkType) + sizeof(UA_UInt32)),
14803  .binaryEncodingId = 0,
14804  .membersSize = 2,
14805  .members = TcpMessageHeader_members },
14806 
14807 /* ChunkType */
14808 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14809  .typeIndex = UA_TYPES_INT32,
14810 #ifdef UA_ENABLE_TYPENAMES
14811  .typeName = "ChunkType",
14812 #endif
14813  .memSize = sizeof(UA_ChunkType),
14814  .builtin = true,
14815  .fixedSize = true,
14816  .overlayable = UA_BINARY_OVERLAYABLE_INTEGER,
14817  .binaryEncodingId = 0,
14818  .membersSize = 1,
14819  .members = ChunkType_members },
14820 
14821 /* SymmetricAlgorithmSecurityHeader */
14822 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14824 #ifdef UA_ENABLE_TYPENAMES
14825  .typeName = "SymmetricAlgorithmSecurityHeader",
14826 #endif
14827  .memSize = sizeof(UA_SymmetricAlgorithmSecurityHeader),
14828  .builtin = false,
14829  .fixedSize = true,
14830  .overlayable = true && UA_BINARY_OVERLAYABLE_INTEGER,
14831  .binaryEncodingId = 0,
14832  .membersSize = 1,
14833  .members = SymmetricAlgorithmSecurityHeader_members },
14834 
14835 /* SecureConversationMessageHeader */
14836 { .typeId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 0},
14838 #ifdef UA_ENABLE_TYPENAMES
14839  .typeName = "SecureConversationMessageHeader",
14840 #endif
14841  .memSize = sizeof(UA_SecureConversationMessageHeader),
14842  .builtin = false,
14843  .fixedSize = true,
14844  .overlayable = true && true && UA_BINARY_OVERLAYABLE_INTEGER && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_TcpMessageHeader, messageSize) == (offsetof(UA_TcpMessageHeader, messageTypeAndChunkType) + sizeof(UA_UInt32)) && UA_BINARY_OVERLAYABLE_INTEGER && offsetof(UA_SecureConversationMessageHeader, secureChannelId) == (offsetof(UA_SecureConversationMessageHeader, messageHeader) + sizeof(UA_TcpMessageHeader)),
14845  .binaryEncodingId = 0,
14846  .membersSize = 2,
14847  .members = SecureConversationMessageHeader_members },
14848 };
14849 
14850 
14851 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_connection.c" ***********************************/
14852 
14853 /* This Source Code Form is subject to the terms of the Mozilla Public
14854 * License, v. 2.0. If a copy of the MPL was not distributed with this
14855 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
14856 
14857 
14859  UA_ByteString_deleteMembers(&connection->incompleteMessage);
14860 }
14861 
14864  UA_Boolean *realloced) {
14866 
14867  /* We have a stored an incomplete chunk. Concat the received message to the end.
14868  * After this block, connection->incompleteMessage is always empty. */
14869  if(connection->incompleteMessage.length > 0) {
14870  size_t length = connection->incompleteMessage.length + message->length;
14871  UA_Byte *data = (UA_Byte*)UA_realloc(connection->incompleteMessage.data, length);
14872  if(!data) {
14874  goto cleanup;
14875  }
14876  memcpy(&data[connection->incompleteMessage.length], message->data, message->length);
14877  connection->releaseRecvBuffer(connection, message);
14878  message->data = data;
14879  message->length = length;
14880  *realloced = true;
14881  connection->incompleteMessage = UA_BYTESTRING_NULL;
14882  }
14883 
14884  /* Loop over the chunks in the received buffer */
14885  size_t complete_until = 0; /* the received complete chunks end at this point */
14886  UA_Boolean garbage_end = false; /* garbage after the last complete message */
14887  while(message->length - complete_until >= 8) {
14888  /* Check the message type */
14889  UA_UInt32 msgtype = (UA_UInt32)message->data[complete_until] +
14890  ((UA_UInt32)message->data[complete_until+1] << 8) +
14891  ((UA_UInt32)message->data[complete_until+2] << 16);
14892  if(msgtype != ('M' + ('S' << 8) + ('G' << 16)) &&
14893  msgtype != ('E' + ('R' << 8) + ('R' << 16)) &&
14894  msgtype != ('O' + ('P' << 8) + ('N' << 16)) &&
14895  msgtype != ('H' + ('E' << 8) + ('L' << 16)) &&
14896  msgtype != ('A' + ('C' << 8) + ('K' << 16)) &&
14897  msgtype != ('C' + ('L' << 8) + ('O' << 16))) {
14898  garbage_end = true; /* the message type is not recognized */
14899  break;
14900  }
14901 
14902  /* Decode the length of the chunk */
14903  UA_UInt32 chunk_length = 0;
14904  size_t length_pos = complete_until + 4;
14905  UA_StatusCode decode_retval = UA_UInt32_decodeBinary(message, &length_pos, &chunk_length);
14906 
14907  /* The message size is not allowed. Throw the remaining bytestring away */
14908  if(decode_retval != UA_STATUSCODE_GOOD ||
14909  chunk_length < 16 ||
14910  chunk_length > connection->localConf.recvBufferSize) {
14911  garbage_end = true;
14912  break;
14913  }
14914 
14915  /* The chunk is okay but incomplete. Store the end. */
14916  if(chunk_length + complete_until > message->length)
14917  break;
14918 
14919  complete_until += chunk_length; /* Go to the next chunk */
14920  }
14921 
14922  /* Separate incomplete chunks */
14923  if(complete_until != message->length) {
14924  /* Garbage after the last good chunk. No need to keep a buffer */
14925  if(garbage_end) {
14926  if(complete_until == 0)
14927  goto cleanup; /* All garbage, only happens on messages from the network layer */
14928  message->length = complete_until;
14929  return UA_STATUSCODE_GOOD;
14930  }
14931 
14932  /* No good chunk, only an incomplete one */
14933  if(complete_until == 0) {
14934  if(!*realloced) {
14935  retval = UA_ByteString_allocBuffer(&connection->incompleteMessage, message->length);
14936  if(retval != UA_STATUSCODE_GOOD)
14937  goto cleanup;
14938  memcpy(connection->incompleteMessage.data, message->data, message->length);
14939  connection->releaseRecvBuffer(connection, message);
14940  *realloced = true;
14941  } else {
14942  connection->incompleteMessage = *message;
14943  *message = UA_BYTESTRING_NULL;
14944  }
14945  return UA_STATUSCODE_GOOD;
14946  }
14947 
14948  /* At least one good chunk and an incomplete one */
14949  size_t incomplete_length = message->length - complete_until;
14950  retval = UA_ByteString_allocBuffer(&connection->incompleteMessage, incomplete_length);
14951  if(retval != UA_STATUSCODE_GOOD)
14952  goto cleanup;
14953  memcpy(connection->incompleteMessage.data,
14954  &message->data[complete_until], incomplete_length);
14955  message->length = complete_until;
14956  }
14957 
14958  return UA_STATUSCODE_GOOD;
14959 
14960  cleanup:
14961  if(!*realloced)
14962  connection->releaseRecvBuffer(connection, message);
14963  UA_ByteString_deleteMembers(&connection->incompleteMessage);
14964  return retval;
14965 }
14966 
14969  UA_Boolean *realloced, UA_UInt32 timeout) {
14971  UA_DateTime maxDate = now + (timeout * UA_MSEC_TO_DATETIME);
14972  *realloced = false;
14973 
14975  while(true) {
14976  /* Listen for messages to arrive */
14977  retval = connection->recv(connection, chunks, timeout);
14978 
14979  /* Get complete chunks and return */
14980  retval |= UA_Connection_completeMessages(connection, chunks, realloced);
14981  if(retval != UA_STATUSCODE_GOOD || chunks->length > 0)
14982  break;
14983 
14984  /* We received a message. But the chunk is incomplete. Compute the
14985  * remaining timeout. */
14986  now = UA_DateTime_nowMonotonic();
14987  if(now > maxDate)
14989  timeout = (UA_UInt32)((maxDate - now) / UA_MSEC_TO_DATETIME);
14990  }
14991  return retval;
14992 }
14993 
14994 
14996  UA_SecureChannel *channel = connection->channel;
14997  if(channel)
14998  /* only replace when the channel points to this connection */
14999  UA_atomic_cmpxchg((void**)&channel->connection, connection, NULL);
15000  UA_atomic_xchg((void**)&connection->channel, NULL);
15001 }
15002 
15003 // TODO: Return an error code
15004 void
15006  UA_SecureChannel *channel) {
15007  if(UA_atomic_cmpxchg((void**)&channel->connection, NULL, connection) == NULL)
15008  UA_atomic_xchg((void**)&connection->channel, (void*)channel);
15009 }
15010 
15012 UA_EndpointUrl_split_ptr(const char *endpointUrl, char *hostname,
15013  const char ** port, const char **path) {
15014  if (!endpointUrl || !hostname)
15016 
15017  size_t urlLength = strlen(endpointUrl);
15018  if(urlLength < 10 || urlLength >= 256)
15020 
15021  if(strncmp(endpointUrl, "opc.tcp://", 10) != 0)
15023 
15024  if (urlLength == 10) {
15025  hostname[0] = '\0';
15026  port = NULL;
15027  *path = NULL;
15028  }
15029 
15030  /* where does the port begin? */
15031  size_t portpos = 10;
15032  // opc.tcp://[2001:0db8:85a3::8a2e:0370:7334]:1234/path
15033  // if ip6, then end not found, otherwise we are fine
15034  UA_Boolean ip6_end_found = endpointUrl[portpos] != '[';
15035  for(; portpos < urlLength; ++portpos) {
15036  if (!ip6_end_found) {
15037  if (endpointUrl[portpos] == ']')
15038  ip6_end_found = UA_TRUE;
15039  continue;
15040  }
15041 
15042  if(endpointUrl[portpos] == ':' || endpointUrl[portpos] == '/')
15043  break;
15044  }
15045 
15046  memcpy(hostname, &endpointUrl[10], portpos - 10);
15047  hostname[portpos-10] = 0;
15048 
15049  if(port) {
15050  if (portpos < urlLength - 1) {
15051  if (endpointUrl[portpos] == '/')
15052  *port = NULL;
15053  else
15054  *port = &endpointUrl[portpos + 1];
15055  } else {
15056  *port = NULL;
15057  }
15058  }
15059 
15060  if(path) {
15061  size_t pathpos = portpos < urlLength ? portpos : 10;
15062  for(; pathpos < urlLength; ++pathpos) {
15063  if(endpointUrl[pathpos] == '/')
15064  break;
15065  }
15066  if (pathpos < urlLength-1)
15067  *path = &endpointUrl[pathpos+1]; // do not include slash in path
15068  else
15069  *path = NULL;
15070  }
15071 
15072  return UA_STATUSCODE_GOOD;
15073 }
15074 
15075 
15077 UA_EndpointUrl_split(const char *endpointUrl, char *hostname,
15078  UA_UInt16 * port, const char ** path) {
15079  const char* portTmp = NULL;
15080  const char* pathTmp = NULL;
15081  UA_StatusCode retval = UA_EndpointUrl_split_ptr(endpointUrl, hostname, &portTmp, &pathTmp);
15082  if(retval != UA_STATUSCODE_GOOD) {
15083  if(hostname)
15084  hostname[0] = '\0';
15085  return retval;
15086  }
15087  if(!port && !path)
15088  return UA_STATUSCODE_GOOD;
15089 
15090  char portStr[6];
15091  portStr[0] = '\0';
15092  if(portTmp) {
15093  size_t portLen;
15094  if (pathTmp)
15095  portLen = (size_t)(pathTmp-portTmp-1);
15096  else
15097  portLen = strlen(portTmp);
15098 
15099  if (portLen > 5) // max is 65535
15101 
15102  memcpy(portStr, portTmp, portLen);
15103  portStr[portLen]='\0';
15104 
15105  if(port) {
15106  for (size_t i=0; i<6; ++i) {
15107  if (portStr[i] == 0)
15108  break;
15109  if (portStr[i] < '0' || portStr[i] > '9')
15111  }
15112 
15113  UA_UInt32 p;
15114  UA_readNumber((UA_Byte*)portStr, 6, &p);
15115  if (p>65535)
15117  *port = (UA_UInt16)p;
15118  }
15119  } else {
15120  if (port)
15121  *port = 0;
15122  }
15123  if (path)
15124  *path = pathTmp;
15125  return UA_STATUSCODE_GOOD;
15126 }
15127 
15128 size_t UA_readNumber(UA_Byte *buf, size_t buflen, UA_UInt32 *number) {
15129  if (!buf)
15130  return 0;
15131  UA_UInt32 n = 0;
15132  size_t progress = 0;
15133  /* read numbers until the end or a non-number character appears */
15134  while(progress < buflen) {
15135  UA_Byte c = buf[progress];
15136  if('0' > c || '9' < c)
15137  break;
15138  n = (n*10) + (UA_UInt32)(c-'0');
15139  ++progress;
15140  }
15141  *number = n;
15142  return progress;
15143 }
15144 
15145 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_securechannel.c" ***********************************/
15146 
15147 /* This Source Code Form is subject to the terms of the Mozilla Public
15148 * License, v. 2.0. If a copy of the MPL was not distributed with this
15149 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
15150 
15151 
15152 #define UA_SECURE_MESSAGE_HEADER_LENGTH 24
15153 
15155  memset(channel, 0, sizeof(UA_SecureChannel));
15156  /* Linked lists are also initialized by zeroing out */
15157  /* LIST_INIT(&channel->sessions); */
15158  /* LIST_INIT(&channel->chunks); */
15159 }
15160 
15162  /* Delete members */
15163  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&channel->serverAsymAlgSettings);
15164  UA_ByteString_deleteMembers(&channel->serverNonce);
15165  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&channel->clientAsymAlgSettings);
15166  UA_ByteString_deleteMembers(&channel->clientNonce);
15167  UA_ChannelSecurityToken_deleteMembers(&channel->securityToken);
15168  UA_ChannelSecurityToken_deleteMembers(&channel->nextSecurityToken);
15169 
15170  /* Detach from the channel */
15171  if(channel->connection)
15173 
15174  /* Remove session pointers (not the sessions) */
15175  struct SessionEntry *se, *temp;
15176  LIST_FOREACH_SAFE(se, &channel->sessions, pointers, temp) {
15177  if(se->session)
15178  se->session->channel = NULL;
15179  LIST_REMOVE(se, pointers);
15180  UA_free(se);
15181  }
15182 
15183  /* Remove the buffered chunks */
15184  struct ChunkEntry *ch, *temp_ch;
15185  LIST_FOREACH_SAFE(ch, &channel->chunks, pointers, temp_ch) {
15186  UA_ByteString_deleteMembers(&ch->bytes);
15187  LIST_REMOVE(ch, pointers);
15188  UA_free(ch);
15189  }
15190 }
15191 
15192 //TODO implement real nonce generator - DUMMY function
15194  if(!(nonce->data = UA_malloc(1)))
15196  nonce->length = 1;
15197  nonce->data[0] = 'a';
15198  return UA_STATUSCODE_GOOD;
15199 }
15200 
15201 #if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
15202 #pragma GCC diagnostic push
15203 #pragma GCC diagnostic ignored "-Wextra"
15204 #pragma GCC diagnostic ignored "-Wcast-qual"
15205 #pragma GCC diagnostic ignored "-Wunused-value"
15206 #endif
15207 
15208 void UA_SecureChannel_attachSession(UA_SecureChannel *channel, UA_Session *session) {
15209  struct SessionEntry *se = UA_malloc(sizeof(struct SessionEntry));
15210  if(!se)
15211  return;
15212  se->session = session;
15213  if(UA_atomic_cmpxchg((void**)&session->channel, NULL, channel) != NULL) {
15214  UA_free(se);
15215  return;
15216  }
15217  LIST_INSERT_HEAD(&channel->sessions, se, pointers);
15218 }
15219 
15220 #if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
15221 #pragma GCC diagnostic pop
15222 #endif
15223 
15224 void UA_SecureChannel_detachSession(UA_SecureChannel *channel, UA_Session *session) {
15225  if(session)
15226  session->channel = NULL;
15227  struct SessionEntry *se;
15228  LIST_FOREACH(se, &channel->sessions, pointers) {
15229  if(se->session == session)
15230  break;
15231  }
15232  if(!se)
15233  return;
15234  LIST_REMOVE(se, pointers);
15235  UA_free(se);
15236 }
15237 
15239  struct SessionEntry *se;
15240  LIST_FOREACH(se, &channel->sessions, pointers) {
15241  if(UA_NodeId_equal(&se->session->authenticationToken, token))
15242  break;
15243  }
15244  if(!se)
15245  return NULL;
15246  return se->session;
15247 }
15248 
15250  if(channel->nextSecurityToken.tokenId == 0) //no security token issued
15251  return;
15252 
15253  //FIXME: not thread-safe
15254  memcpy(&channel->securityToken, &channel->nextSecurityToken,
15255  sizeof(UA_ChannelSecurityToken));
15256  UA_ChannelSecurityToken_init(&channel->nextSecurityToken);
15257 }
15258 
15259 /***********************/
15260 /* Send Binary Message */
15261 /***********************/
15262 
15263 static UA_StatusCode
15264 UA_SecureChannel_sendChunk(UA_ChunkInfo *ci, UA_ByteString *dst, size_t offset) {
15265  UA_SecureChannel *channel = ci->channel;
15266  UA_Connection *connection = channel->connection;
15267  if(!connection)
15269 
15270  /* adjust the buffer where the header was hidden */
15271  dst->data = &dst->data[-UA_SECURE_MESSAGE_HEADER_LENGTH];
15274 
15275  if(ci->messageSizeSoFar + offset > connection->remoteConf.maxMessageSize &&
15276  connection->remoteConf.maxMessageSize > 0)
15278  if(++ci->chunksSoFar > connection->remoteConf.maxChunkCount &&
15279  connection->remoteConf.maxChunkCount > 0)
15281 
15282  /* Prepare the chunk headers */
15284  respHeader.secureChannelId = channel->securityToken.channelId;
15286  if(ci->errorCode == UA_STATUSCODE_GOOD) {
15287  if(ci->final)
15289  else
15291  } else {
15292  /* abort message */
15293  ci->final = true; /* mark as finished */
15295  UA_String errorMsg;
15296  UA_String_init(&errorMsg);
15298  UA_UInt32_encodeBinary(&ci->errorCode, dst, &offset);
15299  UA_String_encodeBinary(&errorMsg, dst, &offset);
15300  }
15301  respHeader.messageHeader.messageSize = (UA_UInt32)offset;
15302  ci->messageSizeSoFar += offset;
15303 
15304  /* Encode the header at the beginning of the buffer */
15306  symSecHeader.tokenId = channel->securityToken.tokenId;
15307  UA_SequenceHeader seqHeader;
15308  seqHeader.requestId = ci->requestId;
15309  seqHeader.sequenceNumber = UA_atomic_add(&channel->sendSequenceNumber, 1);
15310  size_t offset_header = 0;
15311  UA_SecureConversationMessageHeader_encodeBinary(&respHeader, dst, &offset_header);
15312  UA_SymmetricAlgorithmSecurityHeader_encodeBinary(&symSecHeader, dst, &offset_header);
15313  UA_SequenceHeader_encodeBinary(&seqHeader, dst, &offset_header);
15314 
15315  /* Send the chunk, the buffer is freed in the network layer */
15316  dst->length = offset; /* set the buffer length to the content length */
15317  connection->send(channel->connection, dst);
15318 
15319  /* Replace with the buffer for the next chunk */
15320  if(!ci->final) {
15321  UA_StatusCode retval =
15322  connection->getSendBuffer(connection, connection->localConf.sendBufferSize, dst);
15323  if(retval != UA_STATUSCODE_GOOD)
15324  return retval;
15325  /* Forward the data pointer so that the payload is encoded after the message header.
15326  * TODO: This works but is a bit too clever. Instead, we could return an offset to the
15327  * binary encoding exchangeBuffer function. */
15330  }
15331  return ci->errorCode;
15332 }
15333 
15336  const void *content, const UA_DataType *contentType) {
15337  UA_Connection *connection = channel->connection;
15338  if(!connection)
15340 
15341  /* Allocate the message buffer */
15342  UA_ByteString message;
15343  UA_StatusCode retval =
15344  connection->getSendBuffer(connection, connection->localConf.sendBufferSize, &message);
15345  if(retval != UA_STATUSCODE_GOOD)
15346  return retval;
15347 
15348  /* Hide the message beginning where the header will be encoded */
15349  message.data = &message.data[UA_SECURE_MESSAGE_HEADER_LENGTH];
15351 
15352  /* Encode the message type */
15353  size_t messagePos = 0;
15354  UA_NodeId typeId = contentType->typeId; /* always numeric */
15355  typeId.identifier.numeric = contentType->binaryEncodingId;
15356  UA_NodeId_encodeBinary(&typeId, &message, &messagePos);
15357 
15358  /* Encode with the chunking callback */
15359  UA_ChunkInfo ci;
15360  ci.channel = channel;
15361  ci.requestId = requestId;
15362  ci.chunksSoFar = 0;
15363  ci.messageSizeSoFar = 0;
15364  ci.final = false;
15367  if(typeId.identifier.numeric == 446 || typeId.identifier.numeric == 449)
15369  else if(typeId.identifier.numeric == 452 || typeId.identifier.numeric == 455)
15371  retval = UA_encodeBinary(content, contentType,
15372  (UA_exchangeEncodeBuffer)UA_SecureChannel_sendChunk,
15373  &ci, &message, &messagePos);
15374 
15375  /* Encoding failed, release the message */
15376  if(retval != UA_STATUSCODE_GOOD) {
15377  if(!ci.final) {
15378  /* the abort message was not send */
15379  ci.errorCode = retval;
15380  UA_SecureChannel_sendChunk(&ci, &message, messagePos);
15381  }
15382  return retval;
15383  }
15384 
15385  /* Encoding finished, send the final chunk */
15386  ci.final = UA_TRUE;
15387  return UA_SecureChannel_sendChunk(&ci, &message, messagePos);
15388 }
15389 
15390 /***************************/
15391 /* Process Received Chunks */
15392 /***************************/
15393 
15394 static void
15395 UA_SecureChannel_removeChunk(UA_SecureChannel *channel, UA_UInt32 requestId) {
15396  struct ChunkEntry *ch;
15397  LIST_FOREACH(ch, &channel->chunks, pointers) {
15398  if(ch->requestId == requestId) {
15399  UA_ByteString_deleteMembers(&ch->bytes);
15400  LIST_REMOVE(ch, pointers);
15401  UA_free(ch);
15402  return;
15403  }
15404  }
15405 }
15406 
15407 /* assume that chunklength fits */
15408 static void
15409 appendChunk(struct ChunkEntry *ch, const UA_ByteString *msg,
15410  size_t offset, size_t chunklength) {
15411  UA_Byte* new_bytes = UA_realloc(ch->bytes.data, ch->bytes.length + chunklength);
15412  if(!new_bytes) {
15413  UA_ByteString_deleteMembers(&ch->bytes);
15414  return;
15415  }
15416  ch->bytes.data = new_bytes;
15417  memcpy(&ch->bytes.data[ch->bytes.length], &msg->data[offset], chunklength);
15418  ch->bytes.length += chunklength;
15419 }
15420 
15421 static void
15422 UA_SecureChannel_appendChunk(UA_SecureChannel *channel, UA_UInt32 requestId,
15423  const UA_ByteString *msg, size_t offset,
15424  size_t chunklength) {
15425  /* Check if the chunk fits into the message */
15426  if(msg->length - offset < chunklength) {
15427  /* can't process all chunks for that request */
15428  UA_SecureChannel_removeChunk(channel, requestId);
15429  return;
15430  }
15431 
15432  /* Get the chunkentry */
15433  struct ChunkEntry *ch;
15434  LIST_FOREACH(ch, &channel->chunks, pointers) {
15435  if(ch->requestId == requestId)
15436  break;
15437  }
15438 
15439  /* No chunkentry on the channel, create one */
15440  if(!ch) {
15441  ch = UA_malloc(sizeof(struct ChunkEntry));
15442  if(!ch)
15443  return;
15444  ch->requestId = requestId;
15445  UA_ByteString_init(&ch->bytes);
15446  LIST_INSERT_HEAD(&channel->chunks, ch, pointers);
15447  }
15448 
15449  appendChunk(ch, msg, offset, chunklength);
15450 }
15451 
15452 static UA_ByteString
15453 UA_SecureChannel_finalizeChunk(UA_SecureChannel *channel, UA_UInt32 requestId,
15454  const UA_ByteString *msg, size_t offset,
15455  size_t chunklength, UA_Boolean *deleteChunk) {
15456  if(msg->length - offset < chunklength) {
15457  /* can't process all chunks for that request */
15458  UA_SecureChannel_removeChunk(channel, requestId);
15459  return UA_BYTESTRING_NULL;
15460  }
15461 
15462  struct ChunkEntry *ch;
15463  LIST_FOREACH(ch, &channel->chunks, pointers) {
15464  if(ch->requestId == requestId)
15465  break;
15466  }
15467 
15468  UA_ByteString bytes;
15469  if(!ch) {
15470  *deleteChunk = false;
15471  bytes.length = chunklength;
15472  bytes.data = msg->data + offset;
15473  } else {
15474  *deleteChunk = true;
15475  appendChunk(ch, msg, offset, chunklength);
15476  bytes = ch->bytes;
15477  LIST_REMOVE(ch, pointers);
15478  UA_free(ch);
15479  }
15480  return bytes;
15481 }
15482 
15483 static UA_StatusCode
15484 UA_SecureChannel_processSequenceNumber(UA_SecureChannel *channel, UA_UInt32 SequenceNumber) {
15485  /* Does the sequence number match? */
15486  if(SequenceNumber != channel->receiveSequenceNumber + 1) {
15487  if(channel->receiveSequenceNumber + 1 > 4294966271 && SequenceNumber < 1024)
15488  channel->receiveSequenceNumber = SequenceNumber - 1; /* Roll over */
15489  else
15491  }
15492  ++channel->receiveSequenceNumber;
15493  return UA_STATUSCODE_GOOD;
15494 }
15495 
15498  UA_ProcessMessageCallback callback, void *application) {
15500  size_t offset= 0;
15501  do {
15502 
15503  if (chunks->length > 3 && chunks->data[offset] == 'E' &&
15504  chunks->data[offset+1] == 'R' && chunks->data[offset+2] == 'R') {
15505  UA_TcpMessageHeader header;
15506  retval = UA_TcpMessageHeader_decodeBinary(chunks, &offset, &header);
15507  if(retval != UA_STATUSCODE_GOOD)
15508  break;
15509 
15510  UA_TcpErrorMessage errorMessage;
15511  retval = UA_TcpErrorMessage_decodeBinary(chunks, &offset, &errorMessage);
15512  if(retval != UA_STATUSCODE_GOOD)
15513  break;
15514 
15515  callback(application, channel, UA_MESSAGETYPE_ERR, 0, (void*)&errorMessage);
15516  continue;
15517  }
15518 
15519  /* Store the initial offset to compute the header length */
15520  size_t initial_offset = offset;
15521 
15522  /* Decode header */
15524  retval = UA_SecureConversationMessageHeader_decodeBinary(chunks, &offset, &header);
15525  if(retval != UA_STATUSCODE_GOOD)
15526  break;
15527 
15528  /* Is the channel attached to connection? */
15529  if(header.secureChannelId != channel->securityToken.channelId) {
15530  //Service_CloseSecureChannel(server, channel);
15531  //connection->close(connection);
15533  }
15534 
15535  /* Use requestId = 0 with OPN as argument for the callback */
15536  UA_SequenceHeader sequenceHeader;
15537  UA_SequenceHeader_init(&sequenceHeader);
15538 
15539  if((header.messageHeader.messageTypeAndChunkType & 0x00ffffff) != UA_MESSAGETYPE_OPN) {
15540  /* Check the symmetric security header (not for OPN) */
15541  UA_UInt32 tokenId = 0;
15542  retval |= UA_UInt32_decodeBinary(chunks, &offset, &tokenId);
15543  retval |= UA_SequenceHeader_decodeBinary(chunks, &offset, &sequenceHeader);
15544  if(retval != UA_STATUSCODE_GOOD)
15546 
15547  /* Does the token match? */
15548  if(tokenId != channel->securityToken.tokenId) {
15549  if(tokenId != channel->nextSecurityToken.tokenId)
15552  }
15553 
15554  /* Does the sequence number match? */
15555  retval = UA_SecureChannel_processSequenceNumber(channel, sequenceHeader.sequenceNumber);
15556  if(retval != UA_STATUSCODE_GOOD)
15558  }
15559 
15560  /* Process chunk */
15561  size_t processed_header = offset - initial_offset;
15562  switch(header.messageHeader.messageTypeAndChunkType & 0xff000000) {
15564  UA_SecureChannel_appendChunk(channel, sequenceHeader.requestId, chunks, offset,
15565  header.messageHeader.messageSize - processed_header);
15566  break;
15567  case UA_CHUNKTYPE_FINAL: {
15568  UA_Boolean realloced = false;
15569  UA_ByteString message =
15570  UA_SecureChannel_finalizeChunk(channel, sequenceHeader.requestId, chunks, offset,
15571  header.messageHeader.messageSize - processed_header,
15572  &realloced);
15573  if(message.length > 0) {
15574  callback(application, channel, header.messageHeader.messageTypeAndChunkType & 0x00ffffff,
15575  sequenceHeader.requestId, &message);
15576  if(realloced)
15577  UA_ByteString_deleteMembers(&message);
15578  }
15579  break; }
15580  case UA_CHUNKTYPE_ABORT:
15581  UA_SecureChannel_removeChunk(channel, sequenceHeader.requestId);
15582  break;
15583  default:
15585  }
15586 
15587  /* Jump to the end of the chunk */
15588  offset += (header.messageHeader.messageSize - processed_header);
15589  } while(chunks->length > offset);
15590 
15591  return retval;
15592 }
15593 
15594 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/ua_session.c" ***********************************/
15595 
15596 /* This Source Code Form is subject to the terms of the Mozilla Public
15597 * License, v. 2.0. If a copy of the MPL was not distributed with this
15598 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
15599 
15600 #ifdef UA_ENABLE_SUBSCRIPTIONS
15601 #endif
15602 
15603 UA_Session adminSession = {
15604  .clientDescription = {.applicationUri = {0, NULL}, .productUri = {0, NULL},
15605  .applicationName = {.locale = {0, NULL}, .text = {0, NULL}},
15606  .applicationType = UA_APPLICATIONTYPE_CLIENT,
15607  .gatewayServerUri = {0, NULL}, .discoveryProfileUri = {0, NULL},
15608  .discoveryUrlsSize = 0, .discoveryUrls = NULL},
15609  .sessionName = {sizeof("Administrator Session")-1, (UA_Byte*)"Administrator Session"},
15610  .authenticationToken = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15611  .identifier.numeric = 1},
15612  .sessionId = {.namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC, .identifier.numeric = 1},
15613  .maxRequestMessageSize = UA_UINT32_MAX, .maxResponseMessageSize = UA_UINT32_MAX,
15614  .timeout = (UA_Double)UA_INT64_MAX, .validTill = UA_INT64_MAX, .channel = NULL,
15615  .continuationPoints = {NULL}};
15616 
15617 void UA_Session_init(UA_Session *session) {
15618  UA_ApplicationDescription_init(&session->clientDescription);
15619  session->activated = false;
15620  UA_NodeId_init(&session->authenticationToken);
15621  UA_NodeId_init(&session->sessionId);
15622  UA_String_init(&session->sessionName);
15623  session->maxRequestMessageSize = 0;
15624  session->maxResponseMessageSize = 0;
15625  session->timeout = 0;
15626  UA_DateTime_init(&session->validTill);
15627  session->channel = NULL;
15629  LIST_INIT(&session->continuationPoints);
15630 #ifdef UA_ENABLE_SUBSCRIPTIONS
15631  LIST_INIT(&session->serverSubscriptions);
15632  session->lastSubscriptionID = 0;
15633  SIMPLEQ_INIT(&session->responseQueue);
15634 #endif
15635 }
15636 
15637 void UA_Session_deleteMembersCleanup(UA_Session *session, UA_Server* server) {
15638  UA_ApplicationDescription_deleteMembers(&session->clientDescription);
15639  UA_NodeId_deleteMembers(&session->authenticationToken);
15640  UA_NodeId_deleteMembers(&session->sessionId);
15641  UA_String_deleteMembers(&session->sessionName);
15642  struct ContinuationPointEntry *cp, *temp;
15643  LIST_FOREACH_SAFE(cp, &session->continuationPoints, pointers, temp) {
15644  LIST_REMOVE(cp, pointers);
15645  UA_ByteString_deleteMembers(&cp->identifier);
15646  UA_BrowseDescription_deleteMembers(&cp->browseDescription);
15647  UA_free(cp);
15648  }
15649  if(session->channel)
15650  UA_SecureChannel_detachSession(session->channel, session);
15651 #ifdef UA_ENABLE_SUBSCRIPTIONS
15652  UA_Subscription *currents, *temps;
15653  LIST_FOREACH_SAFE(currents, &session->serverSubscriptions, listEntry, temps) {
15654  LIST_REMOVE(currents, listEntry);
15655  UA_Subscription_deleteMembers(currents, server);
15656  UA_free(currents);
15657  }
15658  UA_PublishResponseEntry *entry;
15659  while((entry = SIMPLEQ_FIRST(&session->responseQueue))) {
15660  SIMPLEQ_REMOVE_HEAD(&session->responseQueue, listEntry);
15661  UA_PublishResponse_deleteMembers(&entry->response);
15662  UA_free(entry);
15663  }
15664 #endif
15665 }
15666 
15667 void UA_Session_updateLifetime(UA_Session *session) {
15668  session->validTill = UA_DateTime_nowMonotonic() +
15669  (UA_DateTime)(session->timeout * UA_MSEC_TO_DATETIME);
15670 }
15671 
15672 #ifdef UA_ENABLE_SUBSCRIPTIONS
15673 
15674 void UA_Session_addSubscription(UA_Session *session, UA_Subscription *newSubscription) {
15675  LIST_INSERT_HEAD(&session->serverSubscriptions, newSubscription, listEntry);
15676 }
15677 
15679 UA_Session_deleteSubscription(UA_Server *server, UA_Session *session,
15680  UA_UInt32 subscriptionID) {
15681  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, subscriptionID);
15682  if(!sub)
15684  LIST_REMOVE(sub, listEntry);
15685  UA_Subscription_deleteMembers(sub, server);
15686  UA_free(sub);
15687  return UA_STATUSCODE_GOOD;
15688 }
15689 
15691 UA_Session_getSubscriptionByID(UA_Session *session, UA_UInt32 subscriptionID) {
15692  UA_Subscription *sub;
15693  LIST_FOREACH(sub, &session->serverSubscriptions, listEntry) {
15694  if(sub->subscriptionID == subscriptionID)
15695  break;
15696  }
15697  return sub;
15698 }
15699 
15700 UA_UInt32 UA_Session_getUniqueSubscriptionID(UA_Session *session) {
15701  return ++(session->lastSubscriptionID);
15702 }
15703 
15704 #endif
15705 
15706 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_server.c" ***********************************/
15707 
15708 /* This Source Code Form is subject to the terms of the Mozilla Public
15709 * License, v. 2.0. If a copy of the MPL was not distributed with this
15710 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
15711 
15712 
15713 #ifdef UA_ENABLE_GENERATE_NAMESPACE0
15714 #endif
15715 
15716 #ifdef UA_ENABLE_SUBSCRIPTIONS
15717 #endif
15718 
15719 #if defined(UA_ENABLE_MULTITHREADING) && !defined(NDEBUG)
15720 UA_THREAD_LOCAL bool rcu_locked = false;
15721 #endif
15722 
15723 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
15724 UA_THREAD_LOCAL UA_Session* methodCallSession = NULL;
15725 #endif
15726 
15727 static const UA_NodeId nodeIdHasSubType = {
15728  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15729  .identifier.numeric = UA_NS0ID_HASSUBTYPE};
15730 static const UA_NodeId nodeIdHasComponent = {
15731  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15732  .identifier.numeric = UA_NS0ID_HASCOMPONENT};
15733 static const UA_NodeId nodeIdHasProperty = {
15734  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15735  .identifier.numeric = UA_NS0ID_HASPROPERTY};
15736 static const UA_NodeId nodeIdOrganizes = {
15737  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15738  .identifier.numeric = UA_NS0ID_ORGANIZES};
15739 
15740 #ifndef UA_ENABLE_GENERATE_NAMESPACE0
15741 static const UA_NodeId nodeIdNonHierarchicalReferences = {
15742  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
15743  .identifier.numeric = UA_NS0ID_NONHIERARCHICALREFERENCES};
15744 #endif
15745 
15746 /**********************/
15747 /* Namespace Handling */
15748 /**********************/
15749 
15750 UA_UInt16 addNamespace(UA_Server *server, const UA_String name) {
15751  /* Check if the namespace already exists in the server's namespace array */
15752  for(UA_UInt16 i=0;i<server->namespacesSize;++i) {
15753  if(UA_String_equal(&name, &server->namespaces[i]))
15754  return i;
15755  }
15756 
15757  /* Add a new namespace to the namsepace array */
15758  UA_String *newNS = UA_realloc(server->namespaces,
15759  sizeof(UA_String) * (server->namespacesSize + 1));
15760  if(!newNS)
15761  return 0;
15762  server->namespaces = newNS;
15763  UA_StatusCode retval = UA_String_copy(&name, &server->namespaces[server->namespacesSize]);
15764  if(retval != UA_STATUSCODE_GOOD)
15765  return 0;
15766  ++server->namespacesSize;
15767  return (UA_UInt16)(server->namespacesSize - 1);
15768 }
15769 
15770 UA_UInt16 UA_Server_addNamespace(UA_Server *server, const char* name) {
15771  /* Override const attribute to get string (dirty hack) */
15772  const UA_String nameString = {.length = strlen(name),
15773  .data = (UA_Byte*)(uintptr_t)name};
15774  return addNamespace(server, nameString);
15775 }
15776 
15777 
15779 UA_Server_forEachChildNodeCall(UA_Server *server, UA_NodeId parentNodeId,
15780  UA_NodeIteratorCallback callback, void *handle) {
15781  UA_RCU_LOCK();
15782  const UA_Node *parent = UA_NodeStore_get(server->nodestore, &parentNodeId);
15783  if(!parent) {
15784  UA_RCU_UNLOCK();
15786  }
15787 
15788  /* TODO: We need to do an ugly copy of the references array since users may
15789  * delete references from within the callback. In single-threaded mode this
15790  * changes the same node we point at here. In multi-threaded mode, this
15791  * creates a new copy as nodes are truly immutable. */
15792  UA_ReferenceNode *refs = NULL;
15793  size_t refssize = parent->referencesSize;
15794  UA_StatusCode retval = UA_Array_copy(parent->references, parent->referencesSize,
15795  (void**)&refs, &UA_TYPES[UA_TYPES_REFERENCENODE]);
15796  if(retval != UA_STATUSCODE_GOOD) {
15797  UA_RCU_UNLOCK();
15798  return retval;
15799  }
15800 
15801  for(size_t i = parent->referencesSize; i > 0; --i) {
15802  UA_ReferenceNode *ref = &refs[i-1];
15803  retval |= callback(ref->targetId.nodeId, ref->isInverse,
15804  ref->referenceTypeId, handle);
15805  }
15806  UA_RCU_UNLOCK();
15807 
15808  UA_Array_delete(refs, refssize, &UA_TYPES[UA_TYPES_REFERENCENODE]);
15809  return retval;
15810 }
15811 
15812 static UA_AddNodesResult
15813 addNodeInternal(UA_Server *server, UA_Node *node, const UA_NodeId parentNodeId,
15814  const UA_NodeId referenceTypeId) {
15815  UA_AddNodesResult res;
15816  UA_AddNodesResult_init(&res);
15817  UA_RCU_LOCK();
15818  res.statusCode = Service_AddNodes_existing(server, &adminSession, node, &parentNodeId,
15819  &referenceTypeId, &UA_NODEID_NULL,
15820  NULL, &res.addedNodeId);
15821  UA_RCU_UNLOCK();
15822  return res;
15823 }
15824 
15825 static UA_AddNodesResult
15826 addNodeInternalWithType(UA_Server *server, UA_Node *node, const UA_NodeId parentNodeId,
15827  const UA_NodeId referenceTypeId, const UA_NodeId typeIdentifier) {
15828  UA_AddNodesResult res;
15829  UA_AddNodesResult_init(&res);
15830  UA_RCU_LOCK();
15831  res.statusCode = Service_AddNodes_existing(server, &adminSession, node, &parentNodeId,
15832  &referenceTypeId, &typeIdentifier,
15833  NULL, &res.addedNodeId);
15834  UA_RCU_UNLOCK();
15835  return res;
15836 }
15837 
15838 // delete any children of an instance without touching the object itself
15839 static void
15840 deleteInstanceChildren(UA_Server *server, UA_NodeId *objectNodeId) {
15841  /* Browse for children */
15842  UA_BrowseDescription bDes;
15843  UA_BrowseDescription_init(&bDes);
15844  bDes.nodeId = *objectNodeId;
15848  UA_BrowseResult bRes = UA_Server_browse(server, 0, &bDes);
15849 
15850  /* Delete Children */
15851  for(size_t i=0; i<bRes.referencesSize; ++i) {
15852  UA_ReferenceDescription *rd = &bRes.references[i];
15854  UA_Server_deleteNode(server, rd->nodeId.nodeId, true);
15855  } else if (rd->nodeClass == UA_NODECLASS_METHOD) {
15856  UA_Server_deleteReference(server, *objectNodeId, rd->referenceTypeId,
15857  true, rd->nodeId, true);
15858  }
15859  }
15860 
15861  UA_BrowseResult_deleteMembers(&bRes);
15862 }
15863 
15864 /**********/
15865 /* Server */
15866 /**********/
15867 
15868 /* The server needs to be stopped before it can be deleted */
15869 void UA_Server_delete(UA_Server *server) {
15870  // Delete the timed work
15872 
15873  // Delete all internal data
15876  UA_RCU_LOCK();
15877  UA_NodeStore_delete(server->nodestore);
15878  UA_RCU_UNLOCK();
15879  UA_Array_delete(server->namespaces, server->namespacesSize, &UA_TYPES[UA_TYPES_STRING]);
15881  &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
15882 
15883 #ifdef UA_ENABLE_MULTITHREADING
15884  pthread_cond_destroy(&server->dispatchQueue_condition);
15885  pthread_mutex_destroy(&server->dispatchQueue_mutex);
15886 #endif
15887  UA_free(server);
15888 }
15889 
15890 /* Recurring cleanup. Removing unused and timed-out channels and sessions */
15891 static void UA_Server_cleanup(UA_Server *server, void *_) {
15892  UA_DateTime nowMonotonic = UA_DateTime_nowMonotonic();
15893  UA_SessionManager_cleanupTimedOut(&server->sessionManager, nowMonotonic);
15895 }
15896 
15897 static UA_StatusCode
15898 readStatus(void *handle, const UA_NodeId nodeid, UA_Boolean sourceTimeStamp,
15899  const UA_NumericRange *range, UA_DataValue *value) {
15900  if(range) {
15901  value->hasStatus = true;
15903  return UA_STATUSCODE_GOOD;
15904  }
15905 
15906  UA_Server *server = (UA_Server*)handle;
15907  UA_ServerStatusDataType *retval = UA_ServerStatusDataType_new();
15908  retval->startTime = server->startTime;
15909  retval->currentTime = UA_DateTime_now();
15910  retval->state = UA_SERVERSTATE_RUNNING;
15911  retval->secondsTillShutdown = 0;
15912  UA_BuildInfo_copy(&server->config.buildInfo, &retval->buildInfo);
15913 
15914  value->value.type = &UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE];
15915  value->value.arrayLength = 0;
15916  value->value.data = retval;
15917  value->value.arrayDimensionsSize = 0;
15918  value->value.arrayDimensions = NULL;
15919  value->hasValue = true;
15920  if(sourceTimeStamp) {
15921  value->hasSourceTimestamp = true;
15922  value->sourceTimestamp = UA_DateTime_now();
15923  }
15924  return UA_STATUSCODE_GOOD;
15925 }
15926 
15928 static UA_StatusCode
15929 readServiceLevel(void *handle, const UA_NodeId nodeid, UA_Boolean sourceTimeStamp,
15930  const UA_NumericRange *range, UA_DataValue *value) {
15931  if(range) {
15932  value->hasStatus = true;
15934  return UA_STATUSCODE_GOOD;
15935  }
15936 
15937  value->value.type = &UA_TYPES[UA_TYPES_BYTE];
15938  value->value.arrayLength = 0;
15939  UA_Byte *byte = UA_Byte_new();
15940  *byte = 255;
15941  value->value.data = byte;
15942  value->value.arrayDimensionsSize = 0;
15943  value->value.arrayDimensions = NULL;
15944  value->hasValue = true;
15945  if(sourceTimeStamp) {
15946  value->hasSourceTimestamp = true;
15947  value->sourceTimestamp = UA_DateTime_now();
15948  }
15949  return UA_STATUSCODE_GOOD;
15950 }
15951 
15953 static UA_StatusCode
15954 readAuditing(void *handle, const UA_NodeId nodeid, UA_Boolean sourceTimeStamp,
15955  const UA_NumericRange *range, UA_DataValue *value) {
15956  if(range) {
15957  value->hasStatus = true;
15959  return UA_STATUSCODE_GOOD;
15960  }
15961 
15962  value->value.type = &UA_TYPES[UA_TYPES_BOOLEAN];
15963  value->value.arrayLength = 0;
15964  UA_Boolean *boolean = UA_Boolean_new();
15965  *boolean = false;
15966  value->value.data = boolean;
15967  value->value.arrayDimensionsSize = 0;
15968  value->value.arrayDimensions = NULL;
15969  value->hasValue = true;
15970  if(sourceTimeStamp) {
15971  value->hasSourceTimestamp = true;
15972  value->sourceTimestamp = UA_DateTime_now();
15973  }
15974  return UA_STATUSCODE_GOOD;
15975 }
15976 
15977 static UA_StatusCode
15978 readNamespaces(void *handle, const UA_NodeId nodeid, UA_Boolean sourceTimestamp,
15979  const UA_NumericRange *range, UA_DataValue *value) {
15980  if(range) {
15981  value->hasStatus = true;
15983  return UA_STATUSCODE_GOOD;
15984  }
15985  UA_Server *server = (UA_Server*)handle;
15986  UA_StatusCode retval;
15987  retval = UA_Variant_setArrayCopy(&value->value, server->namespaces,
15988  server->namespacesSize, &UA_TYPES[UA_TYPES_STRING]);
15989  if(retval != UA_STATUSCODE_GOOD)
15990  return retval;
15991  value->hasValue = true;
15992  if(sourceTimestamp) {
15993  value->hasSourceTimestamp = true;
15994  value->sourceTimestamp = UA_DateTime_now();
15995  }
15996  return UA_STATUSCODE_GOOD;
15997 }
15998 
15999 static UA_StatusCode
16000 writeNamespaces(void *handle, const UA_NodeId nodeid, const UA_Variant *data,
16001  const UA_NumericRange *range) {
16002  UA_Server *server = (UA_Server*)handle;
16003 
16004  /* Check the data type */
16005  if(data->type != &UA_TYPES[UA_TYPES_STRING])
16007 
16008  /* Check that the variant is not empty */
16009  if(!data->data)
16011 
16012  /* TODO: Writing with a range is not implemented */
16013  if(range)
16015 
16016  UA_String *newNamespaces = data->data;
16017  size_t newNamespacesSize = data->arrayLength;
16018 
16019  /* Test if we append to the existing namespaces */
16020  if(newNamespacesSize <= server->namespacesSize)
16022 
16023  /* Test if the existing namespaces are unchanged */
16024  for(size_t i = 0; i < server->namespacesSize; ++i) {
16025  if(!UA_String_equal(&server->namespaces[i], &newNamespaces[i]))
16027  }
16028 
16029  /* Add namespaces */
16030  for(size_t i = server->namespacesSize; i < newNamespacesSize; ++i)
16031  addNamespace(server, newNamespaces[i]);
16032  return UA_STATUSCODE_GOOD;
16033 }
16034 
16035 static UA_StatusCode
16036 readCurrentTime(void *handle, const UA_NodeId nodeid, UA_Boolean sourceTimeStamp,
16037  const UA_NumericRange *range, UA_DataValue *value) {
16038  if(range) {
16039  value->hasStatus = true;
16041  return UA_STATUSCODE_GOOD;
16042  }
16043  UA_DateTime currentTime = UA_DateTime_now();
16044  UA_StatusCode retval = UA_Variant_setScalarCopy(&value->value, &currentTime,
16045  &UA_TYPES[UA_TYPES_DATETIME]);
16046  if(retval != UA_STATUSCODE_GOOD)
16047  return retval;
16048  value->hasValue = true;
16049  if(sourceTimeStamp) {
16050  value->hasSourceTimestamp = true;
16051  value->sourceTimestamp = currentTime;
16052  }
16053  return UA_STATUSCODE_GOOD;
16054 }
16055 
16056 static void copyNames(UA_Node *node, char *name) {
16057  node->browseName = UA_QUALIFIEDNAME_ALLOC(0, name);
16058  node->displayName = UA_LOCALIZEDTEXT_ALLOC("en_US", name);
16059  node->description = UA_LOCALIZEDTEXT_ALLOC("en_US", name);
16060 }
16061 
16062 static void
16063 addDataTypeNode(UA_Server *server, char* name, UA_UInt32 datatypeid,
16064  UA_Boolean isAbstract, UA_UInt32 parent) {
16066  copyNames((UA_Node*)datatype, name);
16067  datatype->nodeId.identifier.numeric = datatypeid;
16068  datatype->isAbstract = isAbstract;
16069  addNodeInternal(server, (UA_Node*)datatype,
16070  UA_NODEID_NUMERIC(0, parent), nodeIdHasSubType);
16071 }
16072 
16073 static void
16074 addObjectTypeNode(UA_Server *server, char* name, UA_UInt32 objecttypeid,
16075  UA_UInt32 parent, UA_UInt32 parentreference) {
16077  copyNames((UA_Node*)objecttype, name);
16078  objecttype->nodeId.identifier.numeric = objecttypeid;
16079  addNodeInternal(server, (UA_Node*)objecttype, UA_NODEID_NUMERIC(0, parent),
16080  UA_NODEID_NUMERIC(0, parentreference));
16081 }
16082 
16083 static UA_VariableTypeNode*
16084 createVariableTypeNode(UA_Server *server, char* name, UA_UInt32 variabletypeid,
16085  UA_Boolean abstract) {
16087  copyNames((UA_Node*)variabletype, name);
16088  variabletype->nodeId.identifier.numeric = variabletypeid;
16089  variabletype->isAbstract = abstract;
16090  return variabletype;
16091 }
16092 
16093 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
16094 static UA_StatusCode
16095 GetMonitoredItems(void *handle, const UA_NodeId objectId, size_t inputSize,
16096  const UA_Variant *input, size_t outputSize, UA_Variant *output) {
16097  UA_UInt32 subscriptionId = *((UA_UInt32*)(input[0].data));
16098  UA_Session* session = methodCallSession;
16099  UA_Subscription* subscription = UA_Session_getSubscriptionByID(session, subscriptionId);
16100  if(!subscription)
16102 
16103  UA_UInt32 sizeOfOutput = 0;
16104  UA_MonitoredItem* monitoredItem;
16105  LIST_FOREACH(monitoredItem, &subscription->monitoredItems, listEntry) {
16106  ++sizeOfOutput;
16107  }
16108  if(sizeOfOutput==0)
16109  return UA_STATUSCODE_GOOD;
16110 
16111  UA_UInt32* clientHandles = UA_Array_new(sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]);
16112  UA_UInt32* serverHandles = UA_Array_new(sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]);
16113  UA_UInt32 i = 0;
16114  LIST_FOREACH(monitoredItem, &subscription->monitoredItems, listEntry) {
16115  clientHandles[i] = monitoredItem->clientHandle;
16116  serverHandles[i] = monitoredItem->itemId;
16117  ++i;
16118  }
16119  UA_Variant_setArray(&output[0], clientHandles, sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]);
16120  UA_Variant_setArray(&output[1], serverHandles, sizeOfOutput, &UA_TYPES[UA_TYPES_UINT32]);
16121  return UA_STATUSCODE_GOOD;
16122 }
16123 #endif
16124 
16125 UA_Server * UA_Server_new(const UA_ServerConfig config) {
16126  UA_Server *server = UA_calloc(1, sizeof(UA_Server));
16127  if(!server)
16128  return NULL;
16129 
16130  server->config = config;
16131  server->nodestore = UA_NodeStore_new();
16132  LIST_INIT(&server->repeatedJobs);
16133 
16134 #ifdef UA_ENABLE_MULTITHREADING
16135  rcu_init();
16136  cds_wfcq_init(&server->dispatchQueue_head, &server->dispatchQueue_tail);
16137  cds_lfs_init(&server->mainLoopJobs);
16138 #else
16139  SLIST_INIT(&server->delayedCallbacks);
16140 #endif
16141 
16142 #ifndef UA_ENABLE_DETERMINISTIC_RNG
16144 #endif
16145 
16146  /* ns0 and ns1 */
16147  server->namespaces = UA_Array_new(2, &UA_TYPES[UA_TYPES_STRING]);
16148  server->namespaces[0] = UA_STRING_ALLOC("http://opcfoundation.org/UA/");
16149  UA_String_copy(&server->config.applicationDescription.applicationUri, &server->namespaces[1]);
16150  server->namespacesSize = 2;
16151 
16152  /* Create endpoints w/o endpointurl. It is added from the networklayers at startup */
16153  server->endpointDescriptions = UA_Array_new(server->config.networkLayersSize,
16154  &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
16155  server->endpointDescriptionsSize = server->config.networkLayersSize;
16156  for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
16157  UA_EndpointDescription *endpoint = &server->endpointDescriptions[i];
16159  endpoint->securityPolicyUri =
16160  UA_STRING_ALLOC("http://opcfoundation.org/UA/SecurityPolicy#None");
16161  endpoint->transportProfileUri =
16162  UA_STRING_ALLOC("http://opcfoundation.org/UA-Profile/Transport/uatcp-uasc-uabinary");
16163 
16164  size_t policies = 0;
16165  if(server->config.enableAnonymousLogin)
16166  ++policies;
16167  if(server->config.enableUsernamePasswordLogin)
16168  ++policies;
16169  endpoint->userIdentityTokensSize = policies;
16170  endpoint->userIdentityTokens = UA_Array_new(policies, &UA_TYPES[UA_TYPES_USERTOKENPOLICY]);
16171 
16172  size_t currentIndex = 0;
16173  if(server->config.enableAnonymousLogin) {
16174  UA_UserTokenPolicy_init(&endpoint->userIdentityTokens[currentIndex]);
16175  endpoint->userIdentityTokens[currentIndex].tokenType = UA_USERTOKENTYPE_ANONYMOUS;
16176  endpoint->userIdentityTokens[currentIndex].policyId = UA_STRING_ALLOC(ANONYMOUS_POLICY);
16177  ++currentIndex;
16178  }
16179  if(server->config.enableUsernamePasswordLogin) {
16180  UA_UserTokenPolicy_init(&endpoint->userIdentityTokens[currentIndex]);
16181  endpoint->userIdentityTokens[currentIndex].tokenType = UA_USERTOKENTYPE_USERNAME;
16182  endpoint->userIdentityTokens[currentIndex].policyId = UA_STRING_ALLOC(USERNAME_POLICY);
16183  }
16184 
16185  /* The standard says "the HostName specified in the Server Certificate is the
16186  same as the HostName contained in the endpointUrl provided in the
16187  EndpointDescription */
16188  UA_String_copy(&server->config.serverCertificate, &endpoint->serverCertificate);
16189  UA_ApplicationDescription_copy(&server->config.applicationDescription, &endpoint->server);
16190 
16191  /* copy the discovery url only once the networlayer has been started */
16192  // UA_String_copy(&server->config.networkLayers[i].discoveryUrl, &endpoint->endpointUrl);
16193  }
16194 
16196  UA_SessionManager_init(&server->sessionManager, server);
16197 
16198  UA_Job cleanup = {.type = UA_JOBTYPE_METHODCALL,
16199  .job.methodCall = {.method = UA_Server_cleanup, .data = NULL} };
16200  UA_Server_addRepeatedJob(server, cleanup, 10000, NULL);
16201 
16202  server->startTime = UA_DateTime_now();
16203 
16204 #ifndef UA_ENABLE_GENERATE_NAMESPACE0
16205 
16206  /*********************************/
16207  /* Bootstrap reference hierarchy */
16208  /*********************************/
16209 
16211  copyNames((UA_Node*)references, "References");
16212  references->nodeId.identifier.numeric = UA_NS0ID_REFERENCES;
16213  references->isAbstract = true;
16214  references->symmetric = true;
16215  references->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "References");
16216 
16218  copyNames((UA_Node*)hassubtype, "HasSubtype");
16219  hassubtype->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "HasSupertype");
16220  hassubtype->nodeId.identifier.numeric = UA_NS0ID_HASSUBTYPE;
16221  hassubtype->isAbstract = false;
16222  hassubtype->symmetric = false;
16223 
16224  UA_RCU_LOCK();
16225  UA_NodeStore_insert(server->nodestore, (UA_Node*)references);
16226  UA_NodeStore_insert(server->nodestore, (UA_Node*)hassubtype);
16227  UA_RCU_UNLOCK();
16228 
16229  UA_ReferenceTypeNode *hierarchicalreferences = UA_NodeStore_newReferenceTypeNode();
16230  copyNames((UA_Node*)hierarchicalreferences, "HierarchicalReferences");
16231  hierarchicalreferences->nodeId.identifier.numeric = UA_NS0ID_HIERARCHICALREFERENCES;
16232  hierarchicalreferences->isAbstract = true;
16233  hierarchicalreferences->symmetric = false;
16234  addNodeInternal(server, (UA_Node*)hierarchicalreferences,
16235  UA_NODEID_NUMERIC(0, UA_NS0ID_REFERENCES), nodeIdHasSubType);
16236 
16237  UA_ReferenceTypeNode *nonhierarchicalreferences = UA_NodeStore_newReferenceTypeNode();
16238  copyNames((UA_Node*)nonhierarchicalreferences, "NonHierarchicalReferences");
16239  nonhierarchicalreferences->nodeId.identifier.numeric = UA_NS0ID_NONHIERARCHICALREFERENCES;
16240  nonhierarchicalreferences->isAbstract = true;
16241  nonhierarchicalreferences->symmetric = false;
16242  addNodeInternal(server, (UA_Node*)nonhierarchicalreferences,
16243  UA_NODEID_NUMERIC(0, UA_NS0ID_REFERENCES), nodeIdHasSubType);
16244 
16246  copyNames((UA_Node*)haschild, "HasChild");
16247  haschild->nodeId.identifier.numeric = UA_NS0ID_HASCHILD;
16248  haschild->isAbstract = false;
16249  haschild->symmetric = false;
16250  addNodeInternal(server, (UA_Node*)haschild,
16251  UA_NODEID_NUMERIC(0, UA_NS0ID_HIERARCHICALREFERENCES), nodeIdHasSubType);
16252 
16254  copyNames((UA_Node*)organizes, "Organizes");
16255  organizes->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "OrganizedBy");
16256  organizes->nodeId.identifier.numeric = UA_NS0ID_ORGANIZES;
16257  organizes->isAbstract = false;
16258  organizes->symmetric = false;
16259  addNodeInternal(server, (UA_Node*)organizes,
16260  UA_NODEID_NUMERIC(0, UA_NS0ID_HIERARCHICALREFERENCES), nodeIdHasSubType);
16261 
16263  copyNames((UA_Node*)haseventsource, "HasEventSource");
16264  haseventsource->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "EventSourceOf");
16265  haseventsource->nodeId.identifier.numeric = UA_NS0ID_HASEVENTSOURCE;
16266  haseventsource->isAbstract = false;
16267  haseventsource->symmetric = false;
16268  addNodeInternal(server, (UA_Node*)haseventsource,
16269  UA_NODEID_NUMERIC(0, UA_NS0ID_HIERARCHICALREFERENCES), nodeIdHasSubType);
16270 
16272  copyNames((UA_Node*)hasmodellingrule, "HasModellingRule");
16273  hasmodellingrule->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "ModellingRuleOf");
16274  hasmodellingrule->nodeId.identifier.numeric = UA_NS0ID_HASMODELLINGRULE;
16275  hasmodellingrule->isAbstract = false;
16276  hasmodellingrule->symmetric = false;
16277  addNodeInternal(server, (UA_Node*)hasmodellingrule, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16278 
16280  copyNames((UA_Node*)hasencoding, "HasEncoding");
16281  hasencoding->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "EncodingOf");
16282  hasencoding->nodeId.identifier.numeric = UA_NS0ID_HASENCODING;
16283  hasencoding->isAbstract = false;
16284  hasencoding->symmetric = false;
16285  addNodeInternal(server, (UA_Node*)hasencoding, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16286 
16288  copyNames((UA_Node*)hasdescription, "HasDescription");
16289  hasdescription->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "DescriptionOf");
16290  hasdescription->nodeId.identifier.numeric = UA_NS0ID_HASDESCRIPTION;
16291  hasdescription->isAbstract = false;
16292  hasdescription->symmetric = false;
16293  addNodeInternal(server, (UA_Node*)hasdescription, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16294 
16296  copyNames((UA_Node*)hastypedefinition, "HasTypeDefinition");
16297  hastypedefinition->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "TypeDefinitionOf");
16298  hastypedefinition->nodeId.identifier.numeric = UA_NS0ID_HASTYPEDEFINITION;
16299  hastypedefinition->isAbstract = false;
16300  hastypedefinition->symmetric = false;
16301  addNodeInternal(server, (UA_Node*)hastypedefinition, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16302 
16304  copyNames((UA_Node*)generatesevent, "GeneratesEvent");
16305  generatesevent->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "GeneratedBy");
16306  generatesevent->nodeId.identifier.numeric = UA_NS0ID_GENERATESEVENT;
16307  generatesevent->isAbstract = false;
16308  generatesevent->symmetric = false;
16309  addNodeInternal(server, (UA_Node*)generatesevent, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16310 
16312  copyNames((UA_Node*)aggregates, "Aggregates");
16313  aggregates->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "AggregatedBy");
16314  aggregates->nodeId.identifier.numeric = UA_NS0ID_AGGREGATES;
16315  aggregates->isAbstract = false;
16316  aggregates->symmetric = false;
16317  addNodeInternal(server, (UA_Node*)aggregates, UA_NODEID_NUMERIC(0, UA_NS0ID_HASCHILD), nodeIdHasSubType);
16318 
16319  /* complete bootstrap of hassubtype */
16320  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_HASCHILD), nodeIdHasSubType,
16321  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE), true);
16322 
16324  copyNames((UA_Node*)hasproperty, "HasProperty");
16325  hasproperty->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "PropertyOf");
16326  hasproperty->nodeId.identifier.numeric = UA_NS0ID_HASPROPERTY;
16327  hasproperty->isAbstract = false;
16328  hasproperty->symmetric = false;
16329  addNodeInternal(server, (UA_Node*)hasproperty,
16330  UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES), nodeIdHasSubType);
16331 
16333  copyNames((UA_Node*)hascomponent, "HasComponent");
16334  hascomponent->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "ComponentOf");
16335  hascomponent->nodeId.identifier.numeric = UA_NS0ID_HASCOMPONENT;
16336  hascomponent->isAbstract = false;
16337  hascomponent->symmetric = false;
16338  addNodeInternal(server, (UA_Node*)hascomponent, UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES), nodeIdHasSubType);
16339 
16341  copyNames((UA_Node*)hasnotifier, "HasNotifier");
16342  hasnotifier->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "NotifierOf");
16343  hasnotifier->nodeId.identifier.numeric = UA_NS0ID_HASNOTIFIER;
16344  hasnotifier->isAbstract = false;
16345  hasnotifier->symmetric = false;
16346  addNodeInternal(server, (UA_Node*)hasnotifier, UA_NODEID_NUMERIC(0, UA_NS0ID_HASEVENTSOURCE), nodeIdHasSubType);
16347 
16349  copyNames((UA_Node*)hasorderedcomponent, "HasOrderedComponent");
16350  hasorderedcomponent->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "OrderedComponentOf");
16351  hasorderedcomponent->nodeId.identifier.numeric = UA_NS0ID_HASORDEREDCOMPONENT;
16352  hasorderedcomponent->isAbstract = false;
16353  hasorderedcomponent->symmetric = false;
16354  addNodeInternal(server, (UA_Node*)hasorderedcomponent, UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT), nodeIdHasSubType);
16355 
16357  copyNames((UA_Node*)hasmodelparent, "HasModelParent");
16358  hasmodelparent->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "ModelParentOf");
16359  hasmodelparent->nodeId.identifier.numeric = UA_NS0ID_HASMODELPARENT;
16360  hasmodelparent->isAbstract = false;
16361  hasmodelparent->symmetric = false;
16362  addNodeInternal(server, (UA_Node*)hasmodelparent, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16363 
16365  copyNames((UA_Node*)fromstate, "FromState");
16366  fromstate->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "ToTransition");
16367  fromstate->nodeId.identifier.numeric = UA_NS0ID_FROMSTATE;
16368  fromstate->isAbstract = false;
16369  fromstate->symmetric = false;
16370  addNodeInternal(server, (UA_Node*)fromstate, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16371 
16373  copyNames((UA_Node*)tostate, "ToState");
16374  tostate->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "FromTransition");
16375  tostate->nodeId.identifier.numeric = UA_NS0ID_TOSTATE;
16376  tostate->isAbstract = false;
16377  tostate->symmetric = false;
16378  addNodeInternal(server, (UA_Node*)tostate, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16379 
16381  copyNames((UA_Node*)hascause, "HasCause");
16382  hascause->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "MayBeCausedBy");
16383  hascause->nodeId.identifier.numeric = UA_NS0ID_HASCAUSE;
16384  hascause->isAbstract = false;
16385  hascause->symmetric = false;
16386  addNodeInternal(server, (UA_Node*)hascause, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16387 
16389  copyNames((UA_Node*)haseffect, "HasEffect");
16390  haseffect->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "MayBeEffectedBy");
16391  haseffect->nodeId.identifier.numeric = UA_NS0ID_HASEFFECT;
16392  haseffect->isAbstract = false;
16393  haseffect->symmetric = false;
16394  addNodeInternal(server, (UA_Node*)haseffect, nodeIdNonHierarchicalReferences, nodeIdHasSubType);
16395 
16396  UA_ReferenceTypeNode *hashistoricalconfiguration = UA_NodeStore_newReferenceTypeNode();
16397  copyNames((UA_Node*)hashistoricalconfiguration, "HasHistoricalConfiguration");
16398  hashistoricalconfiguration->inverseName = UA_LOCALIZEDTEXT_ALLOC("en_US", "HistoricalConfigurationOf");
16399  hashistoricalconfiguration->nodeId.identifier.numeric = UA_NS0ID_HASHISTORICALCONFIGURATION;
16400  hashistoricalconfiguration->isAbstract = false;
16401  hashistoricalconfiguration->symmetric = false;
16402  addNodeInternal(server, (UA_Node*)hashistoricalconfiguration, UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES), nodeIdHasSubType);
16403 
16404  /**************/
16405  /* Data Types */
16406  /**************/
16407 
16409  copyNames((UA_Node*)basedatatype, "BaseDataType");
16410  basedatatype->nodeId.identifier.numeric = UA_NS0ID_BASEDATATYPE;
16411  basedatatype->isAbstract = true;
16412  UA_RCU_LOCK();
16413  UA_NodeStore_insert(server->nodestore, (UA_Node*)basedatatype);
16414  UA_RCU_UNLOCK();
16415 
16416  addDataTypeNode(server, "Boolean", UA_NS0ID_BOOLEAN, false, UA_NS0ID_BASEDATATYPE);
16417  addDataTypeNode(server, "Number", UA_NS0ID_NUMBER, true, UA_NS0ID_BASEDATATYPE);
16418  addDataTypeNode(server, "Float", UA_NS0ID_FLOAT, false, UA_NS0ID_NUMBER);
16419  addDataTypeNode(server, "Double", UA_NS0ID_DOUBLE, false, UA_NS0ID_NUMBER);
16420  addDataTypeNode(server, "Integer", UA_NS0ID_INTEGER, true, UA_NS0ID_NUMBER);
16421  addDataTypeNode(server, "SByte", UA_NS0ID_SBYTE, false, UA_NS0ID_INTEGER);
16422  addDataTypeNode(server, "Int16", UA_NS0ID_INT16, false, UA_NS0ID_INTEGER);
16423  addDataTypeNode(server, "Int32", UA_NS0ID_INT32, false, UA_NS0ID_INTEGER);
16424  addDataTypeNode(server, "Int64", UA_NS0ID_INT64, false, UA_NS0ID_INTEGER);
16425  addDataTypeNode(server, "UInteger", UA_NS0ID_UINTEGER, true, UA_NS0ID_INTEGER);
16426  addDataTypeNode(server, "Byte", UA_NS0ID_BYTE, false, UA_NS0ID_UINTEGER);
16427  addDataTypeNode(server, "UInt16", UA_NS0ID_UINT16, false, UA_NS0ID_UINTEGER);
16428  addDataTypeNode(server, "UInt32", UA_NS0ID_UINT32, false, UA_NS0ID_UINTEGER);
16429  addDataTypeNode(server, "UInt64", UA_NS0ID_UINT64, false, UA_NS0ID_UINTEGER);
16430  addDataTypeNode(server, "String", UA_NS0ID_STRING, false, UA_NS0ID_BASEDATATYPE);
16431  addDataTypeNode(server, "DateTime", UA_NS0ID_DATETIME, false, UA_NS0ID_BASEDATATYPE);
16432  addDataTypeNode(server, "Guid", UA_NS0ID_GUID, false, UA_NS0ID_BASEDATATYPE);
16433  addDataTypeNode(server, "ByteString", UA_NS0ID_BYTESTRING, false, UA_NS0ID_BASEDATATYPE);
16434  addDataTypeNode(server, "XmlElement", UA_NS0ID_XMLELEMENT, false, UA_NS0ID_BASEDATATYPE);
16435  addDataTypeNode(server, "NodeId", UA_NS0ID_NODEID, false, UA_NS0ID_BASEDATATYPE);
16436  addDataTypeNode(server, "ExpandedNodeId", UA_NS0ID_EXPANDEDNODEID, false, UA_NS0ID_BASEDATATYPE);
16437  addDataTypeNode(server, "StatusCode", UA_NS0ID_STATUSCODE, false, UA_NS0ID_BASEDATATYPE);
16438  addDataTypeNode(server, "QualifiedName", UA_NS0ID_QUALIFIEDNAME, false, UA_NS0ID_BASEDATATYPE);
16439  addDataTypeNode(server, "LocalizedText", UA_NS0ID_LOCALIZEDTEXT, false, UA_NS0ID_BASEDATATYPE);
16440  addDataTypeNode(server, "Structure", UA_NS0ID_STRUCTURE, true, UA_NS0ID_BASEDATATYPE);
16441  addDataTypeNode(server, "ServerStatusDataType", UA_NS0ID_SERVERSTATUSDATATYPE, false, UA_NS0ID_STRUCTURE);
16442  addDataTypeNode(server, "BuildInfo", UA_NS0ID_BUILDINFO, false, UA_NS0ID_STRUCTURE);
16443  addDataTypeNode(server, "DataValue", UA_NS0ID_DATAVALUE, false, UA_NS0ID_BASEDATATYPE);
16444  addDataTypeNode(server, "DiagnosticInfo", UA_NS0ID_DIAGNOSTICINFO, false, UA_NS0ID_BASEDATATYPE);
16445  addDataTypeNode(server, "Enumeration", UA_NS0ID_ENUMERATION, true, UA_NS0ID_BASEDATATYPE);
16446  addDataTypeNode(server, "ServerState", UA_NS0ID_SERVERSTATE, false, UA_NS0ID_ENUMERATION);
16447 
16448  /*****************/
16449  /* VariableTypes */
16450  /*****************/
16451 
16452  UA_VariableTypeNode *basevartype =
16453  createVariableTypeNode(server, "BaseVariableType", UA_NS0ID_BASEVARIABLETYPE, true);
16454  basevartype->valueRank = -2;
16455  basevartype->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE);
16456  UA_RCU_LOCK();
16457  UA_NodeStore_insert(server->nodestore, (UA_Node*)basevartype);
16458  UA_RCU_UNLOCK();
16459 
16460  UA_VariableTypeNode *basedatavartype =
16461  createVariableTypeNode(server, "BaseDataVariableType", UA_NS0ID_BASEDATAVARIABLETYPE, false);
16462  basedatavartype->valueRank = -2;
16463  basedatavartype->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE);
16464  addNodeInternalWithType(server, (UA_Node*)basedatavartype,
16465  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE),
16466  nodeIdHasSubType, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE));
16467 
16468  UA_VariableTypeNode *propertytype =
16469  createVariableTypeNode(server, "PropertyType", UA_NS0ID_PROPERTYTYPE, false);
16470  propertytype->valueRank = -2;
16471  propertytype->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE);
16472  addNodeInternalWithType(server, (UA_Node*)propertytype,
16473  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE),
16474  nodeIdHasSubType, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE));
16475 
16476  UA_VariableTypeNode *buildinfotype =
16477  createVariableTypeNode(server, "BuildInfoType", UA_NS0ID_BUILDINFOTYPE, false);
16478  buildinfotype->valueRank = -1;
16479  buildinfotype->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BUILDINFO);
16480  addNodeInternalWithType(server, (UA_Node*)buildinfotype,
16481  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE),
16482  nodeIdHasSubType, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16483 
16484  UA_VariableTypeNode *serverstatustype =
16485  createVariableTypeNode(server, "ServerStatusType", UA_NS0ID_SERVERSTATUSTYPE, false);
16486  serverstatustype->valueRank = -1;
16487  serverstatustype->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVERSTATUSDATATYPE);
16488  addNodeInternalWithType(server, (UA_Node*)serverstatustype,
16489  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE),
16490  nodeIdHasSubType, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16491 
16492  /**********************/
16493  /* Basic Object Types */
16494  /**********************/
16495 
16497  copyNames((UA_Node*)baseobjtype, "BaseObjectType");
16498  baseobjtype->nodeId.identifier.numeric = UA_NS0ID_BASEOBJECTTYPE;
16499  UA_RCU_LOCK();
16500  UA_NodeStore_insert(server->nodestore, (UA_Node*)baseobjtype);
16501  UA_RCU_UNLOCK();
16502 
16503  addObjectTypeNode(server, "ModellingRuleType", UA_NS0ID_MODELLINGRULETYPE,
16505  addObjectTypeNode(server, "FolderType", UA_NS0ID_FOLDERTYPE,
16507  addObjectTypeNode(server, "ServerType", UA_NS0ID_SERVERTYPE,
16509  addObjectTypeNode(server, "ServerDiagnosticsType", UA_NS0ID_SERVERDIAGNOSTICSTYPE,
16511  addObjectTypeNode(server, "ServerCapatilitiesType", UA_NS0ID_SERVERCAPABILITIESTYPE,
16513 
16514  /******************/
16515  /* Root and below */
16516  /******************/
16517 
16518  static const UA_NodeId nodeIdFolderType = {
16519  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
16520  .identifier.numeric = UA_NS0ID_FOLDERTYPE};
16521  static const UA_NodeId nodeIdHasTypeDefinition = {
16522  .namespaceIndex = 0, .identifierType = UA_NODEIDTYPE_NUMERIC,
16523  .identifier.numeric = UA_NS0ID_HASTYPEDEFINITION};
16524 
16526  copyNames((UA_Node*)root, "Root");
16527  root->nodeId.identifier.numeric = UA_NS0ID_ROOTFOLDER;
16528  UA_RCU_LOCK();
16529  UA_NodeStore_insert(server->nodestore, (UA_Node*)root);
16530  UA_RCU_UNLOCK();
16531  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_ROOTFOLDER), nodeIdHasTypeDefinition,
16532  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_FOLDERTYPE), true);
16533 
16535  copyNames((UA_Node*)objects, "Objects");
16536  objects->nodeId.identifier.numeric = UA_NS0ID_OBJECTSFOLDER;
16537  addNodeInternalWithType(server, (UA_Node*)objects, UA_NODEID_NUMERIC(0, UA_NS0ID_ROOTFOLDER),
16538  nodeIdOrganizes, nodeIdFolderType);
16539 
16541  copyNames((UA_Node*)types, "Types");
16542  types->nodeId.identifier.numeric = UA_NS0ID_TYPESFOLDER;
16543  addNodeInternalWithType(server, (UA_Node*)types, UA_NODEID_NUMERIC(0, UA_NS0ID_ROOTFOLDER),
16544  nodeIdOrganizes, nodeIdFolderType);
16545 
16546  UA_ObjectNode *referencetypes = UA_NodeStore_newObjectNode();
16547  copyNames((UA_Node*)referencetypes, "ReferenceTypes");
16548  referencetypes->nodeId.identifier.numeric = UA_NS0ID_REFERENCETYPESFOLDER;
16549  addNodeInternalWithType(server, (UA_Node*)referencetypes, UA_NODEID_NUMERIC(0, UA_NS0ID_TYPESFOLDER),
16550  nodeIdOrganizes, nodeIdFolderType);
16551  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_REFERENCETYPESFOLDER), nodeIdOrganizes,
16552  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_REFERENCES), true);
16553 
16555  copyNames((UA_Node*)datatypes, "DataTypes");
16556  datatypes->nodeId.identifier.numeric = UA_NS0ID_DATATYPESFOLDER;
16557  addNodeInternalWithType(server, (UA_Node*)datatypes, UA_NODEID_NUMERIC(0, UA_NS0ID_TYPESFOLDER),
16558  nodeIdOrganizes, nodeIdFolderType);
16559  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_DATATYPESFOLDER), nodeIdOrganizes,
16560  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE), true);
16561 
16562  UA_ObjectNode *variabletypes = UA_NodeStore_newObjectNode();
16563  copyNames((UA_Node*)variabletypes, "VariableTypes");
16564  variabletypes->nodeId.identifier.numeric = UA_NS0ID_VARIABLETYPESFOLDER;
16565  addNodeInternalWithType(server, (UA_Node*)variabletypes, UA_NODEID_NUMERIC(0, UA_NS0ID_TYPESFOLDER),
16566  nodeIdOrganizes, nodeIdFolderType);
16567  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_VARIABLETYPESFOLDER), nodeIdOrganizes,
16568  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE), true);
16569 
16570  UA_ObjectNode *objecttypes = UA_NodeStore_newObjectNode();
16571  copyNames((UA_Node*)objecttypes, "ObjectTypes");
16572  objecttypes->nodeId.identifier.numeric = UA_NS0ID_OBJECTTYPESFOLDER;
16573  addNodeInternalWithType(server, (UA_Node*)objecttypes, UA_NODEID_NUMERIC(0, UA_NS0ID_TYPESFOLDER),
16574  nodeIdOrganizes, nodeIdFolderType);
16575  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTTYPESFOLDER), nodeIdOrganizes,
16576  UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE), true);
16577 
16578  UA_ObjectNode *eventtypes = UA_NodeStore_newObjectNode();
16579  copyNames((UA_Node*)eventtypes, "EventTypes");
16580  eventtypes->nodeId.identifier.numeric = UA_NS0ID_EVENTTYPESFOLDER;
16581  addNodeInternalWithType(server, (UA_Node*)eventtypes, UA_NODEID_NUMERIC(0, UA_NS0ID_TYPESFOLDER),
16582  nodeIdOrganizes, nodeIdFolderType);
16583 
16585  copyNames((UA_Node*)views, "Views");
16586  views->nodeId.identifier.numeric = UA_NS0ID_VIEWSFOLDER;
16587  addNodeInternalWithType(server, (UA_Node*)views, UA_NODEID_NUMERIC(0, UA_NS0ID_ROOTFOLDER),
16588  nodeIdOrganizes, nodeIdFolderType);
16589 
16590  /*******************/
16591  /* Modelling Rules */
16592  /*******************/
16593 
16595  copyNames((UA_Node*)mandatory, "Mandatory");
16596  mandatory->nodeId.identifier.numeric = UA_NS0ID_MODELLINGRULE_MANDATORY;
16597  addNodeInternalWithType(server, (UA_Node*)mandatory, UA_NODEID_NULL,
16598  UA_NODEID_NULL, UA_NODEID_NUMERIC(0, UA_NS0ID_MODELLINGRULETYPE));
16599 
16601  copyNames((UA_Node*)optional, "Optional");
16602  optional->nodeId.identifier.numeric = UA_NS0ID_MODELLINGRULE_OPTIONAL;
16603  addNodeInternalWithType(server, (UA_Node*)optional, UA_NODEID_NULL,
16604  UA_NODEID_NULL, UA_NODEID_NUMERIC(0, UA_NS0ID_MODELLINGRULETYPE));
16605 
16606 #else
16607  /* load the generated namespace externally */
16608  ua_namespaceinit_generated(server);
16609 #endif
16610 
16611  /*********************/
16612  /* The Server Object */
16613  /*********************/
16614 
16615  /* Create our own server object */
16616  UA_ObjectNode *servernode = UA_NodeStore_newObjectNode();
16617  copyNames((UA_Node*)servernode, "Server");
16618  servernode->nodeId.identifier.numeric = UA_NS0ID_SERVER;
16619  addNodeInternalWithType(server, (UA_Node*)servernode, UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER),
16620  nodeIdOrganizes, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVERTYPE));
16621 
16622  // If we are in an UA conformant namespace, the above function just created a full ServerType object.
16623  // Before readding every variable, delete whatever got instantiated.
16624  // here we can't reuse servernode->nodeId because it may be deleted in addNodeInternalWithType if the node could not be added
16625  UA_NodeId serverNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER);
16626  deleteInstanceChildren(server, &serverNodeId);
16627 
16628  UA_VariableNode *namespaceArray = UA_NodeStore_newVariableNode();
16629  copyNames((UA_Node*)namespaceArray, "NamespaceArray");
16630  namespaceArray->nodeId.identifier.numeric = UA_NS0ID_SERVER_NAMESPACEARRAY;
16631  namespaceArray->valueSource = UA_VALUESOURCE_DATASOURCE;
16632  namespaceArray->value.dataSource = (UA_DataSource) {.handle = server, .read = readNamespaces,
16633  .write = writeNamespaces};
16634  namespaceArray->dataType = UA_TYPES[UA_TYPES_STRING].typeId;
16635  namespaceArray->valueRank = 1;
16636  namespaceArray->minimumSamplingInterval = 1.0;
16637  addNodeInternalWithType(server, (UA_Node*)namespaceArray, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
16638  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16639 
16641  copyNames((UA_Node*)serverArray, "ServerArray");
16642  serverArray->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERARRAY;
16643  UA_Variant_setArrayCopy(&serverArray->value.data.value.value,
16644  &server->config.applicationDescription.applicationUri, 1,
16645  &UA_TYPES[UA_TYPES_STRING]);
16646  serverArray->value.data.value.hasValue = true;
16647  serverArray->valueRank = 1;
16648  serverArray->minimumSamplingInterval = 1.0;
16649  addNodeInternalWithType(server, (UA_Node*)serverArray, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
16650  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16651 
16652  UA_ObjectNode *servercapablities = UA_NodeStore_newObjectNode();
16653  copyNames((UA_Node*)servercapablities, "ServerCapabilities");
16654  servercapablities->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES;
16655  addNodeInternalWithType(server, (UA_Node*)servercapablities, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
16656  nodeIdHasComponent,
16657  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVERCAPABILITIESTYPE));
16658  UA_NodeId ServerCapabilitiesNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES);
16659  deleteInstanceChildren(server, &ServerCapabilitiesNodeId);
16660 
16661  UA_VariableNode *localeIdArray = UA_NodeStore_newVariableNode();
16662  copyNames((UA_Node*)localeIdArray, "LocaleIdArray");
16663  localeIdArray->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_LOCALEIDARRAY;
16664  UA_String enLocale = UA_STRING("en");
16665  UA_Variant_setArrayCopy(&localeIdArray->value.data.value.value,
16666  &enLocale, 1, &UA_TYPES[UA_TYPES_STRING]);
16667  localeIdArray->value.data.value.hasValue = true;
16668  localeIdArray->valueRank = 1;
16669  localeIdArray->minimumSamplingInterval = 1.0;
16670  addNodeInternalWithType(server, (UA_Node*)localeIdArray,
16671  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16672  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16673 
16674  UA_VariableNode *maxBrowseContinuationPoints = UA_NodeStore_newVariableNode();
16675  copyNames((UA_Node*)maxBrowseContinuationPoints, "MaxBrowseContinuationPoints");
16676  maxBrowseContinuationPoints->nodeId.identifier.numeric =
16678  UA_Variant_setScalar(&maxBrowseContinuationPoints->value.data.value.value,
16679  UA_UInt16_new(), &UA_TYPES[UA_TYPES_UINT16]);
16680  maxBrowseContinuationPoints->value.data.value.hasValue = true;
16681  addNodeInternalWithType(server, (UA_Node*)maxBrowseContinuationPoints,
16682  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16683  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16684 
16686 #define MAX_PROFILEARRAY 16 //a *magic* limit to the number of supported profiles
16687 #define ADDPROFILEARRAY(x) profileArray[profileArraySize++] = UA_STRING_ALLOC(x)
16688  UA_String profileArray[MAX_PROFILEARRAY];
16689  UA_UInt16 profileArraySize = 0;
16690  ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/NanoEmbeddedDevice");
16691 
16692 #ifdef UA_ENABLE_SERVICESET_NODEMANAGEMENT
16693  ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/NodeManagement");
16694 #endif
16695 #ifdef UA_ENABLE_SERVICESET_METHOD
16696  ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/Methods");
16697 #endif
16698 #ifdef UA_ENABLE_SUBSCRIPTIONS
16699  ADDPROFILEARRAY("http://opcfoundation.org/UA-Profile/Server/EmbeddedDataChangeSubscription");
16700 #endif
16701 
16702  UA_VariableNode *serverProfileArray = UA_NodeStore_newVariableNode();
16703  copyNames((UA_Node*)serverProfileArray, "ServerProfileArray");
16704  serverProfileArray->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_SERVERPROFILEARRAY;
16705  UA_Variant_setArray(&serverProfileArray->value.data.value.value,
16706  UA_Array_new(profileArraySize, &UA_TYPES[UA_TYPES_STRING]),
16707  profileArraySize, &UA_TYPES[UA_TYPES_STRING]);
16708  for(UA_UInt16 i=0;i<profileArraySize;++i)
16709  ((UA_String *)serverProfileArray->value.data.value.value.data)[i] = profileArray[i];
16710  serverProfileArray->value.data.value.hasValue = true;
16711  serverProfileArray->valueRank = 1;
16712  serverProfileArray->minimumSamplingInterval = 1.0;
16713  addNodeInternalWithType(server, (UA_Node*)serverProfileArray,
16714  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16715  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16716 
16717  UA_VariableNode *softwareCertificates = UA_NodeStore_newVariableNode();
16718  copyNames((UA_Node*)softwareCertificates, "SoftwareCertificates");
16719  softwareCertificates->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_SOFTWARECERTIFICATES;
16720  softwareCertificates->dataType = UA_TYPES[UA_TYPES_SIGNEDSOFTWARECERTIFICATE].typeId;
16721  addNodeInternalWithType(server, (UA_Node*)softwareCertificates,
16722  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16723  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16724 
16725  UA_VariableNode *maxQueryContinuationPoints = UA_NodeStore_newVariableNode();
16726  copyNames((UA_Node*)maxQueryContinuationPoints, "MaxQueryContinuationPoints");
16727  maxQueryContinuationPoints->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXQUERYCONTINUATIONPOINTS;
16728  UA_Variant_setScalar(&maxQueryContinuationPoints->value.data.value.value,
16729  UA_UInt16_new(), &UA_TYPES[UA_TYPES_UINT16]);
16730  maxQueryContinuationPoints->value.data.value.hasValue = true;
16731  addNodeInternalWithType(server, (UA_Node*)maxQueryContinuationPoints,
16732  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16733  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16734 
16735  UA_VariableNode *maxHistoryContinuationPoints = UA_NodeStore_newVariableNode();
16736  copyNames((UA_Node*)maxHistoryContinuationPoints, "MaxHistoryContinuationPoints");
16737  maxHistoryContinuationPoints->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXHISTORYCONTINUATIONPOINTS;
16738  UA_Variant_setScalar(&maxHistoryContinuationPoints->value.data.value.value,
16739  UA_UInt16_new(), &UA_TYPES[UA_TYPES_UINT16]);
16740  maxHistoryContinuationPoints->value.data.value.hasValue = true;
16741  addNodeInternalWithType(server, (UA_Node*)maxHistoryContinuationPoints,
16742  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16743  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16744 
16745  UA_VariableNode *minSupportedSampleRate = UA_NodeStore_newVariableNode();
16746  copyNames((UA_Node*)minSupportedSampleRate, "MinSupportedSampleRate");
16747  minSupportedSampleRate->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_MINSUPPORTEDSAMPLERATE;
16748  UA_Variant_setScalar(&minSupportedSampleRate->value.data.value.value,
16749  UA_Double_new(), &UA_TYPES[UA_TYPES_DOUBLE]);
16750  minSupportedSampleRate->value.data.value.hasValue = true;
16751  addNodeInternalWithType(server, (UA_Node*)minSupportedSampleRate,
16752  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16753  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16754 
16755  UA_ObjectNode *modellingRules = UA_NodeStore_newObjectNode();
16756  copyNames((UA_Node*)modellingRules, "ModellingRules");
16757  modellingRules->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_MODELLINGRULES;
16758  addNodeInternalWithType(server, (UA_Node*)modellingRules,
16759  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES), nodeIdHasProperty,
16760  UA_NODEID_NUMERIC(0, UA_NS0ID_FOLDERTYPE));
16761 
16762  UA_ObjectNode *aggregateFunctions = UA_NodeStore_newObjectNode();
16763  copyNames((UA_Node*)aggregateFunctions, "AggregateFunctions");
16764  aggregateFunctions->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERCAPABILITIES_AGGREGATEFUNCTIONS;
16765  addNodeInternalWithType(server, (UA_Node*)aggregateFunctions,
16766  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERCAPABILITIES),
16767  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_FOLDERTYPE));
16768 
16769  UA_ObjectNode *serverdiagnostics = UA_NodeStore_newObjectNode();
16770  copyNames((UA_Node*)serverdiagnostics, "ServerDiagnostics");
16771  serverdiagnostics->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERDIAGNOSTICS;
16772  addNodeInternalWithType(server, (UA_Node*)serverdiagnostics,
16773  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
16774  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVERDIAGNOSTICSTYPE));
16775  UA_NodeId ServerDiagnosticsNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERDIAGNOSTICS);
16776  deleteInstanceChildren(server, &ServerDiagnosticsNodeId);
16777 
16779  copyNames((UA_Node*)enabledFlag, "EnabledFlag");
16780  enabledFlag->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERDIAGNOSTICS_ENABLEDFLAG;
16781  UA_Variant_setScalar(&enabledFlag->value.data.value.value, UA_Boolean_new(),
16782  &UA_TYPES[UA_TYPES_BOOLEAN]);
16783  enabledFlag->value.data.value.hasValue = true;
16784  enabledFlag->valueRank = 1;
16785  enabledFlag->minimumSamplingInterval = 1.0;
16786  addNodeInternalWithType(server, (UA_Node*)enabledFlag,
16787  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERDIAGNOSTICS),
16788  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16789 
16791  copyNames((UA_Node*)serverstatus, "ServerStatus");
16792  serverstatus->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS);
16793  serverstatus->valueSource = UA_VALUESOURCE_DATASOURCE;
16794  serverstatus->value.dataSource = (UA_DataSource) {.handle = server, .read = readStatus,
16795  .write = NULL};
16796  addNodeInternalWithType(server, (UA_Node*)serverstatus, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
16797  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16798 
16800  copyNames((UA_Node*)starttime, "StartTime");
16801  starttime->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_STARTTIME);
16802  UA_Variant_setScalarCopy(&starttime->value.data.value.value,
16803  &server->startTime, &UA_TYPES[UA_TYPES_DATETIME]);
16804  starttime->value.data.value.hasValue = true;
16805  addNodeInternalWithType(server, (UA_Node*)starttime,
16806  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16807  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16808 
16810  copyNames((UA_Node*)currenttime, "CurrentTime");
16811  currenttime->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_CURRENTTIME);
16812  currenttime->valueSource = UA_VALUESOURCE_DATASOURCE;
16813  currenttime->value.dataSource = (UA_DataSource) {.handle = NULL, .read = readCurrentTime,
16814  .write = NULL};
16815  addNodeInternalWithType(server, (UA_Node*)currenttime,
16816  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16817  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16818 
16820  copyNames((UA_Node*)state, "State");
16821  state->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERSTATUS_STATE;
16822  UA_Variant_setScalar(&state->value.data.value.value, UA_ServerState_new(),
16823  &UA_TYPES[UA_TYPES_SERVERSTATE]);
16824  state->value.data.value.hasValue = true;
16825  state->minimumSamplingInterval = 500.0f;
16826  addNodeInternalWithType(server, (UA_Node*)state, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16827  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16828 
16830  copyNames((UA_Node*)buildinfo, "BuildInfo");
16831  buildinfo->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO);
16832  UA_Variant_setScalarCopy(&buildinfo->value.data.value.value,
16833  &server->config.buildInfo, &UA_TYPES[UA_TYPES_BUILDINFO]);
16834  buildinfo->value.data.value.hasValue = true;
16835  addNodeInternalWithType(server, (UA_Node*)buildinfo,
16836  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16837  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BUILDINFOTYPE));
16838 
16840  copyNames((UA_Node*)producturi, "ProductUri");
16841  producturi->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_PRODUCTURI);
16842  UA_Variant_setScalarCopy(&producturi->value.data.value.value, &server->config.buildInfo.productUri,
16843  &UA_TYPES[UA_TYPES_STRING]);
16844  producturi->value.data.value.hasValue = true;
16845  addNodeInternalWithType(server, (UA_Node*)producturi,
16846  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16847  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16848 
16849  UA_VariableNode *manufacturername = UA_NodeStore_newVariableNode();
16850  copyNames((UA_Node*)manufacturername, "ManufacturerName");
16851  manufacturername->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_MANUFACTURERNAME);
16852  UA_Variant_setScalarCopy(&manufacturername->value.data.value.value,
16853  &server->config.buildInfo.manufacturerName,
16854  &UA_TYPES[UA_TYPES_STRING]);
16855  manufacturername->value.data.value.hasValue = true;
16856  addNodeInternalWithType(server, (UA_Node*)manufacturername,
16857  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16858  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16859 
16861  copyNames((UA_Node*)productname, "ProductName");
16862  productname->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_PRODUCTNAME);
16863  UA_Variant_setScalarCopy(&productname->value.data.value.value, &server->config.buildInfo.productName,
16864  &UA_TYPES[UA_TYPES_STRING]);
16865  productname->value.data.value.hasValue = true;
16866  addNodeInternalWithType(server, (UA_Node*)productname,
16867  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16868  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16869 
16870  UA_VariableNode *softwareversion = UA_NodeStore_newVariableNode();
16871  copyNames((UA_Node*)softwareversion, "SoftwareVersion");
16872  softwareversion->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_SOFTWAREVERSION);
16873  UA_Variant_setScalarCopy(&softwareversion->value.data.value.value,
16874  &server->config.buildInfo.softwareVersion, &UA_TYPES[UA_TYPES_STRING]);
16875  softwareversion->value.data.value.hasValue = true;
16876  addNodeInternalWithType(server, (UA_Node*)softwareversion,
16877  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16878  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16879 
16881  copyNames((UA_Node*)buildnumber, "BuildNumber");
16882  buildnumber->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_BUILDNUMBER);
16883  UA_Variant_setScalarCopy(&buildnumber->value.data.value.value, &server->config.buildInfo.buildNumber,
16884  &UA_TYPES[UA_TYPES_STRING]);
16885  buildnumber->value.data.value.hasValue = true;
16886  addNodeInternalWithType(server, (UA_Node*)buildnumber,
16887  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16888  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16889 
16891  copyNames((UA_Node*)builddate, "BuildDate");
16892  builddate->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_BUILDDATE);
16893  UA_Variant_setScalarCopy(&builddate->value.data.value.value, &server->config.buildInfo.buildDate,
16894  &UA_TYPES[UA_TYPES_DATETIME]);
16895  builddate->value.data.value.hasValue = true;
16896  addNodeInternalWithType(server, (UA_Node*)builddate,
16897  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO),
16898  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16899 
16900  UA_VariableNode *secondstillshutdown = UA_NodeStore_newVariableNode();
16901  copyNames((UA_Node*)secondstillshutdown, "SecondsTillShutdown");
16902  secondstillshutdown->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_SECONDSTILLSHUTDOWN);
16903  UA_Variant_setScalar(&secondstillshutdown->value.data.value.value, UA_UInt32_new(),
16904  &UA_TYPES[UA_TYPES_UINT32]);
16905  secondstillshutdown->value.data.value.hasValue = true;
16906  addNodeInternalWithType(server, (UA_Node*)secondstillshutdown,
16907  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16908  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16909 
16910  UA_VariableNode *shutdownreason = UA_NodeStore_newVariableNode();
16911  copyNames((UA_Node*)shutdownreason, "ShutdownReason");
16912  shutdownreason->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_SHUTDOWNREASON);
16913  UA_Variant_setScalar(&shutdownreason->value.data.value.value, UA_LocalizedText_new(),
16914  &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
16915  shutdownreason->value.data.value.hasValue = true;
16916  addNodeInternalWithType(server, (UA_Node*)shutdownreason,
16917  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
16918  nodeIdHasComponent, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE));
16919 
16921  copyNames((UA_Node*)servicelevel, "ServiceLevel");
16922  servicelevel->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVICELEVEL);
16923  servicelevel->valueSource = UA_VALUESOURCE_DATASOURCE;
16924  servicelevel->value.dataSource = (UA_DataSource) {.handle = server, .read = readServiceLevel,
16925  .write = NULL};
16926  addNodeInternalWithType(server, (UA_Node*)servicelevel,
16927  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER), nodeIdHasComponent,
16928  UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16929 
16931  copyNames((UA_Node*)auditing, "Auditing");
16932  auditing->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_AUDITING);
16933  auditing->valueSource = UA_VALUESOURCE_DATASOURCE;
16934  auditing->value.dataSource = (UA_DataSource) {.handle = server, .read = readAuditing, .write = NULL};
16935  addNodeInternalWithType(server, (UA_Node*)auditing,
16936  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER), nodeIdHasComponent,
16937  UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16938 
16939  UA_ObjectNode *vendorServerInfo = UA_NodeStore_newObjectNode();
16940  copyNames((UA_Node*)vendorServerInfo, "VendorServerInfo");
16941  vendorServerInfo->nodeId.identifier.numeric = UA_NS0ID_SERVER_VENDORSERVERINFO;
16942  addNodeInternalWithType(server, (UA_Node*)vendorServerInfo,
16943  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER), nodeIdHasProperty,
16944  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE));
16945  /*
16946  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_VENDORSERVERINFO),
16947  nodeIdHasTypeDefinition, UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_VENDORSERVERINFOTYPE), true);
16948  */
16949 
16950 
16951  UA_ObjectNode *serverRedundancy = UA_NodeStore_newObjectNode();
16952  copyNames((UA_Node*)serverRedundancy, "ServerRedundancy");
16953  serverRedundancy->nodeId.identifier.numeric = UA_NS0ID_SERVER_SERVERREDUNDANCY;
16954  addNodeInternalWithType(server, (UA_Node*)serverRedundancy,
16955  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER), nodeIdHasProperty,
16956  UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE));
16957  /*
16958  UA_Server_addReference(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERREDUNDANCY),
16959  nodeIdHasTypeDefinition, UA_EXPANDEDNODEID_NUMERIC(0, UA_NS0ID_SERVERREDUNDANCYTYPE), true);
16960  */
16961 
16962  UA_VariableNode *redundancySupport = UA_NodeStore_newVariableNode();
16963  copyNames((UA_Node*)redundancySupport, "RedundancySupport");
16964  redundancySupport->nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERREDUNDANCY_REDUNDANCYSUPPORT);
16965  redundancySupport->valueRank = -1;
16966  redundancySupport->dataType = UA_TYPES[UA_TYPES_INT32].typeId;
16967  //FIXME: enum is needed for type letting it uninitialized for now
16968  UA_Variant_setScalar(&redundancySupport->value.data.value.value, UA_Int32_new(),
16969  &UA_TYPES[UA_TYPES_INT32]);
16970  redundancySupport->value.data.value.hasValue = true;
16971  addNodeInternalWithType(server, (UA_Node*)redundancySupport,
16972  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERREDUNDANCY),
16973  nodeIdHasProperty, UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE));
16974 
16975 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
16976  UA_Argument inputArguments;
16977  UA_Argument_init(&inputArguments);
16978  inputArguments.dataType = UA_TYPES[UA_TYPES_UINT32].typeId;
16979  inputArguments.name = UA_STRING("SubscriptionId");
16980  inputArguments.valueRank = -1; /* scalar argument */
16981 
16982  UA_Argument outputArguments[2];
16983  UA_Argument_init(&outputArguments[0]);
16984  outputArguments[0].dataType = UA_TYPES[UA_TYPES_UINT32].typeId;
16985  outputArguments[0].name = UA_STRING("ServerHandles");
16986  outputArguments[0].valueRank = 1;
16987 
16988  UA_Argument_init(&outputArguments[1]);
16989  outputArguments[1].dataType = UA_TYPES[UA_TYPES_UINT32].typeId;
16990  outputArguments[1].name = UA_STRING("ClientHandles");
16991  outputArguments[1].valueRank = 1;
16992 
16993  UA_MethodAttributes addmethodattributes;
16994  UA_MethodAttributes_init(&addmethodattributes);
16995  addmethodattributes.displayName = UA_LOCALIZEDTEXT("", "GetMonitoredItems");
16996  addmethodattributes.executable = true;
16997  addmethodattributes.userExecutable = true;
16998 
16999  UA_Server_addMethodNode(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_GETMONITOREDITEMS),
17000  UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
17001  UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
17002  UA_QUALIFIEDNAME(0, "GetMonitoredItems"), addmethodattributes,
17003  GetMonitoredItems, /* callback of the method node */
17004  NULL, /* handle passed with the callback */
17005  1, &inputArguments, 2, outputArguments, NULL);
17006 #endif
17007 
17008  return server;
17009 }
17010 
17011 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_server_binary.c" ***********************************/
17012 
17013 /* This Source Code Form is subject to the terms of the Mozilla Public
17014 * License, v. 2.0. If a copy of the MPL was not distributed with this
17015 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
17016 
17017 
17018 /********************/
17019 /* Helper Functions */
17020 /********************/
17021 
17022 static void
17023 sendError(UA_SecureChannel *channel, const UA_ByteString *msg,
17024  size_t offset, const UA_DataType *responseType,
17025  UA_UInt32 requestId, UA_StatusCode error) {
17026  UA_RequestHeader requestHeader;
17027  UA_StatusCode retval = UA_RequestHeader_decodeBinary(msg, &offset, &requestHeader);
17028  if(retval != UA_STATUSCODE_GOOD)
17029  return;
17030  void *response = UA_alloca(responseType->memSize);
17031  UA_init(response, responseType);
17032  UA_ResponseHeader *responseHeader = (UA_ResponseHeader*)response;
17033  responseHeader->requestHandle = requestHeader.requestHandle;
17034  responseHeader->timestamp = UA_DateTime_now();
17035  responseHeader->serviceResult = error;
17036  UA_SecureChannel_sendBinaryMessage(channel, requestId, response, responseType);
17037  UA_RequestHeader_deleteMembers(&requestHeader);
17038  UA_ResponseHeader_deleteMembers(responseHeader);
17039 }
17040 
17041 static void
17042 getServicePointers(UA_UInt32 requestTypeId, const UA_DataType **requestType,
17043  const UA_DataType **responseType, UA_Service *service,
17044  UA_Boolean *requiresSession) {
17045  switch(requestTypeId) {
17047  *service = (UA_Service)Service_GetEndpoints;
17048  *requestType = &UA_TYPES[UA_TYPES_GETENDPOINTSREQUEST];
17049  *responseType = &UA_TYPES[UA_TYPES_GETENDPOINTSRESPONSE];
17050  *requiresSession = false;
17051  break;
17053  *service = (UA_Service)Service_FindServers;
17054  *requestType = &UA_TYPES[UA_TYPES_FINDSERVERSREQUEST];
17055  *responseType = &UA_TYPES[UA_TYPES_FINDSERVERSRESPONSE];
17056  *requiresSession = false;
17057  break;
17059  *service = (UA_Service)Service_CreateSession;
17060  *requestType = &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST];
17061  *responseType = &UA_TYPES[UA_TYPES_CREATESESSIONRESPONSE];
17062  *requiresSession = false;
17063  break;
17065  *service = (UA_Service)Service_ActivateSession;
17066  *requestType = &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST];
17067  *responseType = &UA_TYPES[UA_TYPES_ACTIVATESESSIONRESPONSE];
17068  break;
17070  *service = (UA_Service)Service_CloseSession;
17071  *requestType = &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST];
17072  *responseType = &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE];
17073  break;
17075  *service = (UA_Service)Service_Read;
17076  *requestType = &UA_TYPES[UA_TYPES_READREQUEST];
17077  *responseType = &UA_TYPES[UA_TYPES_READRESPONSE];
17078  break;
17080  *service = (UA_Service)Service_Write;
17081  *requestType = &UA_TYPES[UA_TYPES_WRITEREQUEST];
17082  *responseType = &UA_TYPES[UA_TYPES_WRITERESPONSE];
17083  break;
17085  *service = (UA_Service)Service_Browse;
17086  *requestType = &UA_TYPES[UA_TYPES_BROWSEREQUEST];
17087  *responseType = &UA_TYPES[UA_TYPES_BROWSERESPONSE];
17088  break;
17090  *service = (UA_Service)Service_BrowseNext;
17091  *requestType = &UA_TYPES[UA_TYPES_BROWSENEXTREQUEST];
17092  *responseType = &UA_TYPES[UA_TYPES_BROWSENEXTRESPONSE];
17093  break;
17095  *service = (UA_Service)Service_RegisterNodes;
17096  *requestType = &UA_TYPES[UA_TYPES_REGISTERNODESREQUEST];
17097  *responseType = &UA_TYPES[UA_TYPES_REGISTERNODESRESPONSE];
17098  break;
17100  *service = (UA_Service)Service_UnregisterNodes;
17101  *requestType = &UA_TYPES[UA_TYPES_UNREGISTERNODESREQUEST];
17102  *responseType = &UA_TYPES[UA_TYPES_UNREGISTERNODESRESPONSE];
17103  break;
17106  *requestType = &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSREQUEST];
17107  *responseType = &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE];
17108  break;
17109 
17110 #ifdef UA_ENABLE_SUBSCRIPTIONS
17113  *requestType = &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONREQUEST];
17114  *responseType = &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONRESPONSE];
17115  break;
17117  *requestType = &UA_TYPES[UA_TYPES_PUBLISHREQUEST];
17118  *responseType = &UA_TYPES[UA_TYPES_PUBLISHRESPONSE];
17119  break;
17121  *service = (UA_Service)Service_Republish;
17122  *requestType = &UA_TYPES[UA_TYPES_REPUBLISHREQUEST];
17123  *responseType = &UA_TYPES[UA_TYPES_REPUBLISHRESPONSE];
17124  break;
17127  *requestType = &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONREQUEST];
17128  *responseType = &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE];
17129  break;
17132  *requestType = &UA_TYPES[UA_TYPES_SETPUBLISHINGMODEREQUEST];
17133  *responseType = &UA_TYPES[UA_TYPES_SETPUBLISHINGMODERESPONSE];
17134  break;
17137  *requestType = &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSREQUEST];
17138  *responseType = &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSRESPONSE];
17139  break;
17142  *requestType = &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSREQUEST];
17143  *responseType = &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSRESPONSE];
17144  break;
17147  *requestType = &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSREQUEST];
17148  *responseType = &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSRESPONSE];
17149  break;
17152  *requestType = &UA_TYPES[UA_TYPES_MODIFYMONITOREDITEMSREQUEST];
17153  *responseType = &UA_TYPES[UA_TYPES_MODIFYMONITOREDITEMSRESPONSE];
17154  break;
17157  *requestType = &UA_TYPES[UA_TYPES_SETMONITORINGMODEREQUEST];
17158  *responseType = &UA_TYPES[UA_TYPES_SETMONITORINGMODERESPONSE];
17159  break;
17160 #endif
17161 
17162 #ifdef UA_ENABLE_METHODCALLS
17164  *service = (UA_Service)Service_Call;
17165  *requestType = &UA_TYPES[UA_TYPES_CALLREQUEST];
17166  *responseType = &UA_TYPES[UA_TYPES_CALLRESPONSE];
17167  break;
17168 #endif
17169 
17170 #ifdef UA_ENABLE_NODEMANAGEMENT
17172  *service = (UA_Service)Service_AddNodes;
17173  *requestType = &UA_TYPES[UA_TYPES_ADDNODESREQUEST];
17174  *responseType = &UA_TYPES[UA_TYPES_ADDNODESRESPONSE];
17175  break;
17177  *service = (UA_Service)Service_AddReferences;
17178  *requestType = &UA_TYPES[UA_TYPES_ADDREFERENCESREQUEST];
17179  *responseType = &UA_TYPES[UA_TYPES_ADDREFERENCESRESPONSE];
17180  break;
17182  *service = (UA_Service)Service_DeleteNodes;
17183  *requestType = &UA_TYPES[UA_TYPES_DELETENODESREQUEST];
17184  *responseType = &UA_TYPES[UA_TYPES_DELETENODESRESPONSE];
17185  break;
17188  *requestType = &UA_TYPES[UA_TYPES_DELETEREFERENCESREQUEST];
17189  *responseType = &UA_TYPES[UA_TYPES_DELETEREFERENCESRESPONSE];
17190  break;
17191 #endif
17192 
17193  default:
17194  break;
17195  }
17196 }
17197 
17198 /*************************/
17199 /* Process Message Types */
17200 /*************************/
17201 
17202 /* HEL -> Open up the connection */
17203 static void processHEL(UA_Connection *connection, const UA_ByteString *msg, size_t *offset) {
17204  UA_TcpHelloMessage helloMessage;
17205  if(UA_TcpHelloMessage_decodeBinary(msg, offset, &helloMessage) != UA_STATUSCODE_GOOD) {
17206  connection->close(connection);
17207  return;
17208  }
17209 
17210  /* Parameterize the connection */
17211  connection->remoteConf.maxChunkCount = helloMessage.maxChunkCount; /* zero -> unlimited */
17212  connection->remoteConf.maxMessageSize = helloMessage.maxMessageSize; /* zero -> unlimited */
17213  connection->remoteConf.protocolVersion = helloMessage.protocolVersion;
17214  connection->remoteConf.recvBufferSize = helloMessage.receiveBufferSize;
17215  if(connection->localConf.sendBufferSize > helloMessage.receiveBufferSize)
17216  connection->localConf.sendBufferSize = helloMessage.receiveBufferSize;
17217  connection->remoteConf.sendBufferSize = helloMessage.sendBufferSize;
17218  if(connection->localConf.recvBufferSize > helloMessage.sendBufferSize)
17219  connection->localConf.recvBufferSize = helloMessage.sendBufferSize;
17220  connection->state = UA_CONNECTION_ESTABLISHED;
17221  UA_TcpHelloMessage_deleteMembers(&helloMessage);
17222 
17223  /* Build acknowledge response */
17224  UA_TcpAcknowledgeMessage ackMessage;
17225  ackMessage.protocolVersion = connection->localConf.protocolVersion;
17226  ackMessage.receiveBufferSize = connection->localConf.recvBufferSize;
17227  ackMessage.sendBufferSize = connection->localConf.sendBufferSize;
17228  ackMessage.maxMessageSize = connection->localConf.maxMessageSize;
17229  ackMessage.maxChunkCount = connection->localConf.maxChunkCount;
17230 
17231  UA_TcpMessageHeader ackHeader;
17233  ackHeader.messageSize = 8 + 20; /* ackHeader + ackMessage */
17234 
17235  /* Get the send buffer from the network layer */
17236  UA_ByteString ack_msg;
17237  UA_ByteString_init(&ack_msg);
17238  UA_StatusCode retval =
17239  connection->getSendBuffer(connection, connection->localConf.sendBufferSize, &ack_msg);
17240  if(retval != UA_STATUSCODE_GOOD)
17241  return;
17242 
17243  /* Encode and send the response */
17244  size_t tmpPos = 0;
17245  UA_TcpMessageHeader_encodeBinary(&ackHeader, &ack_msg, &tmpPos);
17246  UA_TcpAcknowledgeMessage_encodeBinary(&ackMessage, &ack_msg, &tmpPos);
17247  ack_msg.length = ackHeader.messageSize;
17248  connection->send(connection, &ack_msg);
17249 }
17250 
17251 /* OPN -> Open up/renew the securechannel */
17252 static void
17253 processOPN(UA_Server *server, UA_Connection *connection,
17254  UA_UInt32 channelId, const UA_ByteString *msg) {
17256  /* Called before HEL */
17257  if(connection->state != UA_CONNECTION_ESTABLISHED)
17259  /* Opening up a channel with a channelid already set */
17260  if(!connection->channel && channelId != 0)
17262  /* Renew a channel with the wrong channelid */
17263  if(connection->channel && channelId != connection->channel->securityToken.channelId)
17265 
17266  /* Decode the request */
17268  UA_SequenceHeader seqHeader;
17269  UA_NodeId requestType;
17271  size_t offset = 0;
17272  retval |= UA_AsymmetricAlgorithmSecurityHeader_decodeBinary(msg, &offset, &asymHeader);
17273  retval |= UA_SequenceHeader_decodeBinary(msg, &offset, &seqHeader);
17274  retval |= UA_NodeId_decodeBinary(msg, &offset, &requestType);
17275  retval |= UA_OpenSecureChannelRequest_decodeBinary(msg, &offset, &r);
17276 
17277  /* Error occured */
17278  if(retval != UA_STATUSCODE_GOOD || requestType.identifier.numeric != 446) {
17279  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
17280  UA_NodeId_deleteMembers(&requestType);
17281  UA_OpenSecureChannelRequest_deleteMembers(&r);
17282  connection->close(connection);
17283  return;
17284  }
17285 
17286  /* Call the service */
17288  UA_OpenSecureChannelResponse_init(&p);
17289  Service_OpenSecureChannel(server, connection, &r, &p);
17290  UA_OpenSecureChannelRequest_deleteMembers(&r);
17291 
17292  /* Opening the channel failed */
17293  UA_SecureChannel *channel = connection->channel;
17294  if(!channel) {
17295  UA_OpenSecureChannelResponse_deleteMembers(&p);
17296  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
17297  connection->close(connection);
17298  return;
17299  }
17300 
17301  /* Set the starting sequence number */
17302  channel->receiveSequenceNumber = seqHeader.sequenceNumber;
17303 
17304  /* Allocate the return message */
17305  UA_ByteString resp_msg;
17306  UA_ByteString_init(&resp_msg);
17307  retval = connection->getSendBuffer(connection, connection->localConf.sendBufferSize, &resp_msg);
17308  if(retval != UA_STATUSCODE_GOOD) {
17309  UA_OpenSecureChannelResponse_deleteMembers(&p);
17310  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
17311  connection->close(connection);
17312  return;
17313  }
17314 
17315  /* Encode the message after the secureconversationmessageheader */
17316  size_t tmpPos = 12; /* skip the header */
17317  seqHeader.sequenceNumber = UA_atomic_add(&channel->sendSequenceNumber, 1);
17318  retval |= UA_AsymmetricAlgorithmSecurityHeader_encodeBinary(&asymHeader, &resp_msg, &tmpPos); // just mirror back
17319  retval |= UA_SequenceHeader_encodeBinary(&seqHeader, &resp_msg, &tmpPos);
17320  UA_NodeId responseType = UA_NODEID_NUMERIC(0, UA_TYPES[UA_TYPES_OPENSECURECHANNELRESPONSE].binaryEncodingId);
17321  retval |= UA_NodeId_encodeBinary(&responseType, &resp_msg, &tmpPos);
17322  retval |= UA_OpenSecureChannelResponse_encodeBinary(&p, &resp_msg, &tmpPos);
17323 
17324  if(retval != UA_STATUSCODE_GOOD) {
17325  connection->releaseSendBuffer(connection, &resp_msg);
17326  UA_OpenSecureChannelResponse_deleteMembers(&p);
17327  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
17328  connection->close(connection);
17329  return;
17330  }
17331 
17332  /* Encode the secureconversationmessageheader (cannot fail) and send */
17335  respHeader.messageHeader.messageSize = (UA_UInt32)tmpPos;
17336  respHeader.secureChannelId = p.securityToken.channelId;
17337  tmpPos = 0;
17338  UA_SecureConversationMessageHeader_encodeBinary(&respHeader, &resp_msg, &tmpPos);
17339  resp_msg.length = respHeader.messageHeader.messageSize;
17340  connection->send(connection, &resp_msg);
17341 
17342  /* Clean up */
17343  UA_OpenSecureChannelResponse_deleteMembers(&p);
17344  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
17345 }
17346 
17347 static void
17348 processMSG(UA_Server *server, UA_SecureChannel *channel,
17349  UA_UInt32 requestId, const UA_ByteString *msg) {
17350  /* At 0, the nodeid starts... */
17351  size_t ppos = 0;
17352  size_t *offset = &ppos;
17353 
17354  /* Decode the nodeid */
17355  UA_NodeId requestTypeId;
17356  UA_StatusCode retval = UA_NodeId_decodeBinary(msg, offset, &requestTypeId);
17357  if(retval != UA_STATUSCODE_GOOD)
17358  return;
17359  if(requestTypeId.identifierType != UA_NODEIDTYPE_NUMERIC)
17360  UA_NodeId_deleteMembers(&requestTypeId); /* leads to badserviceunsupported */
17361 
17362  /* Store the start-position of the request */
17363  size_t requestPos = *offset;
17364 
17365  /* Get the service pointers */
17366  UA_Service service = NULL;
17367  const UA_DataType *requestType = NULL;
17368  const UA_DataType *responseType = NULL;
17369  UA_Boolean sessionRequired = true;
17370  getServicePointers(requestTypeId.identifier.numeric, &requestType,
17371  &responseType, &service, &sessionRequired);
17372  if(!requestType) {
17373  if(requestTypeId.identifier.numeric == 787) {
17374  UA_LOG_INFO_CHANNEL(server->config.logger, channel,
17375  "Client requested a subscription, " \
17376  "but those are not enabled in the build");
17377  } else {
17378  UA_LOG_INFO_CHANNEL(server->config.logger, channel,
17379  "Unknown request with type identifier %i",
17380  requestTypeId.identifier.numeric);
17381  }
17382  sendError(channel, msg, requestPos, &UA_TYPES[UA_TYPES_SERVICEFAULT],
17384  return;
17385  }
17386  UA_assert(responseType);
17387 
17388 #ifdef UA_ENABLE_NONSTANDARD_STATELESS
17389  /* Stateless extension: Sessions are optional */
17390  sessionRequired = false;
17391 #endif
17392 
17393  /* Decode the request */
17394  void *request = UA_alloca(requestType->memSize);
17395  UA_RequestHeader *requestHeader = (UA_RequestHeader*)request;
17396  retval = UA_decodeBinary(msg, offset, request, requestType);
17397  if(retval != UA_STATUSCODE_GOOD) {
17398  UA_LOG_DEBUG_CHANNEL(server->config.logger, channel,
17399  "Could not decode the request");
17400  sendError(channel, msg, requestPos, responseType, requestId, retval);
17401  return;
17402  }
17403 
17404  /* Prepare the respone */
17405  void *response = UA_alloca(responseType->memSize);
17406  UA_init(response, responseType);
17407  UA_Session *session = NULL; /* must be initialized before goto send_response */
17408 
17409  /* CreateSession doesn't need a session */
17410  if(requestType == &UA_TYPES[UA_TYPES_CREATESESSIONREQUEST]) {
17411  Service_CreateSession(server, channel, request, response);
17412  goto send_response;
17413  }
17414 
17415  /* Find the matching session */
17416  session = UA_SecureChannel_getSession(channel, &requestHeader->authenticationToken);
17417  if(!session)
17418  session = UA_SessionManager_getSession(&server->sessionManager,
17419  &requestHeader->authenticationToken);
17420 
17421  if(requestType == &UA_TYPES[UA_TYPES_ACTIVATESESSIONREQUEST]) {
17422  if(!session) {
17423  UA_LOG_DEBUG_CHANNEL(server->config.logger, channel,
17424  "Trying to activate a session that is " \
17425  "not known in the server");
17426  sendError(channel, msg, requestPos, responseType,
17428  UA_deleteMembers(request, requestType);
17429  return;
17430  }
17431  Service_ActivateSession(server, channel, session, request, response);
17432  goto send_response;
17433  }
17434 
17435  /* Set an anonymous, inactive session for services that need no session */
17436  UA_Session anonymousSession;
17437  if(!session) {
17438  if(sessionRequired) {
17439  UA_LOG_INFO_CHANNEL(server->config.logger, channel,
17440  "Service request %i without a valid session",
17441  requestType->binaryEncodingId);
17442  sendError(channel, msg, requestPos, responseType,
17444  UA_deleteMembers(request, requestType);
17445  return;
17446  }
17447  UA_Session_init(&anonymousSession);
17448  anonymousSession.sessionId = UA_NODEID_GUID(0, UA_GUID_NULL);
17449  anonymousSession.channel = channel;
17450  session = &anonymousSession;
17451  }
17452 
17453  /* Trying to use a non-activated session? */
17454  if(sessionRequired && !session->activated) {
17455  UA_LOG_INFO_SESSION(server->config.logger, session,
17456  "Calling service %i on a non-activated session",
17457  requestType->binaryEncodingId);
17458  sendError(channel, msg, requestPos, responseType,
17461  &session->authenticationToken);
17462  UA_deleteMembers(request, requestType);
17463  return;
17464  }
17465 
17466  /* The session is bound to another channel */
17467  if(session->channel != channel) {
17468  UA_LOG_DEBUG_CHANNEL(server->config.logger, channel,
17469  "Client tries to use an obsolete securechannel");
17470  sendError(channel, msg, requestPos, responseType,
17472  UA_deleteMembers(request, requestType);
17473  return;
17474  }
17475 
17476  /* Update the session lifetime */
17477  UA_Session_updateLifetime(session);
17478 
17479 #ifdef UA_ENABLE_SUBSCRIPTIONS
17480  /* The publish request is not answered immediately */
17481  if(requestType == &UA_TYPES[UA_TYPES_PUBLISHREQUEST]) {
17482  Service_Publish(server, session, request, requestId);
17483  UA_deleteMembers(request, requestType);
17484  return;
17485  }
17486 #endif
17487 
17488  /* Call the service */
17489  UA_assert(service); /* For all services besides publish, the service pointer is non-NULL*/
17490  service(server, session, request, response);
17491 
17492  send_response:
17493  /* Send the response */
17494  ((UA_ResponseHeader*)response)->requestHandle = requestHeader->requestHandle;
17495  ((UA_ResponseHeader*)response)->timestamp = UA_DateTime_now();
17496  retval = UA_SecureChannel_sendBinaryMessage(channel, requestId, response, responseType);
17497 
17498  if(retval != UA_STATUSCODE_GOOD)
17499  UA_LOG_INFO_CHANNEL(server->config.logger, channel,
17500  "Could not send the message over the SecureChannel "
17501  "with StatusCode %s", UA_StatusCode_name(retval));
17502 
17503  /* Clean up */
17504  UA_deleteMembers(request, requestType);
17505  UA_deleteMembers(response, responseType);
17506 }
17507 
17508 /* ERR -> Error from the remote connection */
17509 static void processERR(UA_Server *server, UA_Connection *connection, const UA_ByteString *msg, size_t *offset) {
17510  UA_TcpErrorMessage errorMessage;
17511  if (UA_TcpErrorMessage_decodeBinary(msg, offset, &errorMessage) != UA_STATUSCODE_GOOD) {
17512  connection->close(connection);
17513  return;
17514  }
17515 
17516  UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_NETWORK,
17517  "Client replied with an error message: %s %.*s",
17518  UA_StatusCode_name(errorMessage.error), errorMessage.reason.length, errorMessage.reason.data);
17519 }
17520 
17521 /* Takes decoded messages starting at the nodeid of the content type. Only OPN
17522  * messages start at the asymmetricalgorithmsecurityheader and are not
17523  * decoded. */
17524 static void
17525 UA_Server_processSecureChannelMessage(UA_Server *server, UA_SecureChannel *channel,
17526  UA_MessageType messagetype, UA_UInt32 requestId,
17527  const UA_ByteString *message) {
17528  UA_assert(channel);
17529  UA_assert(channel->connection);
17530  switch(messagetype) {
17531  case UA_MESSAGETYPE_ERR: {
17532  const UA_TcpErrorMessage *msg = (const UA_TcpErrorMessage *) message;
17533  UA_LOG_ERROR_CHANNEL(server->config.logger, channel,
17534  "Client replied with an error message: %s %.*s",
17535  UA_StatusCode_name(msg->error), msg->reason.length, msg->reason.data);
17536  break;
17537  }
17538  case UA_MESSAGETYPE_HEL:
17539  UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
17540  "Cannot process a HEL on an open channel");
17541  break;
17542  case UA_MESSAGETYPE_OPN:
17543  UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
17544  "Process an OPN on an open channel");
17545  processOPN(server, channel->connection, channel->securityToken.channelId, message);
17546  break;
17547  case UA_MESSAGETYPE_MSG:
17548  UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
17549  "Process a MSG", channel->connection->sockfd);
17550  processMSG(server, channel, requestId, message);
17551  break;
17552  case UA_MESSAGETYPE_CLO:
17553  UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
17554  "Process a CLO", channel->connection->sockfd);
17555  Service_CloseSecureChannel(server, channel);
17556  break;
17557  default:
17558  UA_LOG_TRACE_CHANNEL(server->config.logger, channel,
17559  "Unknown message type");
17560  }
17561 }
17562 
17563 /* Takes the raw message from the network layer */
17564 void
17565 UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection,
17566  const UA_ByteString *message) {
17567  UA_SecureChannel *channel = connection->channel;
17568  if(channel) {
17569  /* Assemble chunks in the securechannel and process complete messages */
17570  UA_StatusCode retval =
17571  UA_SecureChannel_processChunks(channel, message,
17572  (UA_ProcessMessageCallback*)UA_Server_processSecureChannelMessage, server);
17573  if(retval != UA_STATUSCODE_GOOD)
17574  UA_LOG_TRACE_CHANNEL(server->config.logger, channel, "Procesing chunks "
17575  "resulted in error code %s", UA_StatusCode_name(retval));
17576  } else {
17577  /* Process messages without a channel and no chunking */
17578  size_t offset = 0;
17579  UA_TcpMessageHeader tcpMessageHeader;
17580  UA_StatusCode retval = UA_TcpMessageHeader_decodeBinary(message, &offset, &tcpMessageHeader);
17581  if(retval != UA_STATUSCODE_GOOD) {
17582  connection->close(connection);
17583  return;
17584  }
17585 
17586  /* Dispatch according to the message type */
17587  switch(tcpMessageHeader.messageTypeAndChunkType & 0x00ffffff) {
17588  case UA_MESSAGETYPE_ERR:
17589  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17590  "Connection %i | Process ERR message", connection->sockfd);
17591  processERR(server, connection, message, &offset);
17592  break;
17593  case UA_MESSAGETYPE_HEL:
17594  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17595  "Connection %i | Process HEL message", connection->sockfd);
17596  processHEL(connection, message, &offset);
17597  break;
17598  case UA_MESSAGETYPE_OPN: {
17599  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17600  "Connection %i | Process OPN message", connection->sockfd);
17601  UA_UInt32 channelId = 0;
17602  retval = UA_UInt32_decodeBinary(message, &offset, &channelId);
17603  if(retval != UA_STATUSCODE_GOOD)
17604  connection->close(connection);
17605  UA_ByteString offsetMessage = (UA_ByteString){
17606  .data = message->data + 12, .length = message->length - 12};
17607  processOPN(server, connection, channelId, &offsetMessage);
17608  break; }
17609  case UA_MESSAGETYPE_MSG:
17610  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17611  "Connection %i | Processing a MSG message not possible "
17612  "without a SecureChannel", connection->sockfd);
17613  connection->close(connection);
17614  break;
17615  case UA_MESSAGETYPE_CLO:
17616  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17617  "Connection %i | Processing a CLO message not possible "
17618  "without a SecureChannel", connection->sockfd);
17619  connection->close(connection);
17620  break;
17621  default:
17622  UA_LOG_TRACE(server->config.logger, UA_LOGCATEGORY_NETWORK,
17623  "Connection %i | Unknown message type", connection->sockfd);
17624  connection->close(connection);
17625  }
17626  }
17627 }
17628 
17629 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_server_utils.c" ***********************************/
17630 
17631 /* This Source Code Form is subject to the terms of the Mozilla Public
17632 * License, v. 2.0. If a copy of the MPL was not distributed with this
17633 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
17634 
17635 
17636 /**********************/
17637 /* Parse NumericRange */
17638 /**********************/
17639 
17640 static size_t
17641 readDimension(UA_Byte *buf, size_t buflen, UA_NumericRangeDimension *dim) {
17642  size_t progress = UA_readNumber(buf, buflen, &dim->min);
17643  if(progress == 0)
17644  return 0;
17645  if(buflen <= progress + 1 || buf[progress] != ':') {
17646  dim->max = dim->min;
17647  return progress;
17648  }
17649 
17650  ++progress;
17651  size_t progress2 = UA_readNumber(&buf[progress], buflen - progress, &dim->max);
17652  if(progress2 == 0)
17653  return 0;
17654 
17655  /* invalid range */
17656  if(dim->min >= dim->max)
17657  return 0;
17658 
17659  return progress + progress2;
17660 }
17661 
17664  size_t idx = 0;
17665  size_t dimensionsMax = 0;
17666  UA_NumericRangeDimension *dimensions = NULL;
17668  size_t offset = 0;
17669  while(true) {
17670  /* alloc dimensions */
17671  if(idx >= dimensionsMax) {
17672  UA_NumericRangeDimension *newds;
17673  size_t newdssize = sizeof(UA_NumericRangeDimension) * (dimensionsMax + 2);
17674  newds = UA_realloc(dimensions, newdssize);
17675  if(!newds) {
17677  break;
17678  }
17679  dimensions = newds;
17680  dimensionsMax = dimensionsMax + 2;
17681  }
17682 
17683  /* read the dimension */
17684  size_t progress = readDimension(&str->data[offset], str->length - offset,
17685  &dimensions[idx]);
17686  if(progress == 0) {
17688  break;
17689  }
17690  offset += progress;
17691  ++idx;
17692 
17693  /* loop into the next dimension */
17694  if(offset >= str->length)
17695  break;
17696 
17697  if(str->data[offset] != ',') {
17699  break;
17700  }
17701  ++offset;
17702  }
17703 
17704  if(retval == UA_STATUSCODE_GOOD && idx > 0) {
17705  range->dimensions = dimensions;
17706  range->dimensionsSize = idx;
17707  } else
17708  UA_free(dimensions);
17709 
17710  return retval;
17711 }
17712 
17713 /********************************/
17714 /* Information Model Operations */
17715 /********************************/
17716 
17718 getTypeHierarchy(UA_NodeStore *ns, const UA_Node *rootRef, UA_Boolean inverse,
17719  UA_NodeId **typeHierarchy, size_t *typeHierarchySize) {
17720  size_t results_size = 20; // probably too big, but saves mallocs
17721  UA_NodeId *results = UA_malloc(sizeof(UA_NodeId) * results_size);
17722  if(!results)
17724 
17725  UA_StatusCode retval = UA_NodeId_copy(&rootRef->nodeId, &results[0]);
17726  if(retval != UA_STATUSCODE_GOOD) {
17727  UA_free(results);
17728  return retval;
17729  }
17730 
17731  const UA_Node *node = rootRef;
17732  size_t idx = 0; /* Current index (contains NodeId of node) */
17733  size_t last = 0; /* Index of the last element in the array */
17734  const UA_NodeId hasSubtypeNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
17735  while(true) {
17736  for(size_t i = 0; i < node->referencesSize; ++i) {
17737  /* is the reference relevant? */
17738  if(node->references[i].isInverse != inverse ||
17739  !UA_NodeId_equal(&hasSubtypeNodeId, &node->references[i].referenceTypeId))
17740  continue;
17741 
17742  /* is the target already considered? (multi-inheritance) */
17743  UA_Boolean duplicate = false;
17744  for(size_t j = 0; j <= last; ++j) {
17745  if(UA_NodeId_equal(&node->references[i].targetId.nodeId, &results[j])) {
17746  duplicate = true;
17747  break;
17748  }
17749  }
17750  if(duplicate)
17751  continue;
17752 
17753  /* increase array length if necessary */
17754  if(last + 1 >= results_size) {
17755  UA_NodeId *new_results =
17756  UA_realloc(results, sizeof(UA_NodeId) * results_size * 2);
17757  if(!new_results) {
17759  break;
17760  }
17761  results = new_results;
17762  results_size *= 2;
17763  }
17764 
17765  /* copy new nodeid to the end of the list */
17766  retval = UA_NodeId_copy(&node->references[i].targetId.nodeId, &results[++last]);
17767  if(retval != UA_STATUSCODE_GOOD)
17768  break;
17769  }
17770 
17771  /* Get the next node */
17772  next:
17773  ++idx;
17774  if(idx > last || retval != UA_STATUSCODE_GOOD)
17775  break;
17776  node = UA_NodeStore_get(ns, &results[idx]);
17777  if(!node || node->nodeClass != rootRef->nodeClass)
17778  goto next;
17779  }
17780 
17781  if(retval != UA_STATUSCODE_GOOD) {
17782  UA_Array_delete(results, last, &UA_TYPES[UA_TYPES_NODEID]);
17783  return retval;
17784  }
17785 
17786  *typeHierarchy = results;
17787  *typeHierarchySize = last + 1;
17788  return UA_STATUSCODE_GOOD;
17789 }
17790 
17791 UA_Boolean
17792 isNodeInTree(UA_NodeStore *ns, const UA_NodeId *leafNode, const UA_NodeId *nodeToFind,
17793  const UA_NodeId *referenceTypeIds, size_t referenceTypeIdsSize) {
17794  if(UA_NodeId_equal(leafNode, nodeToFind))
17795  return true;
17796 
17797  const UA_Node *node = UA_NodeStore_get(ns,leafNode);
17798  if(!node)
17799  return false;
17800 
17801  /* Search upwards in the tree */
17802  for(size_t i = 0; i < node->referencesSize; ++i) {
17803  if(!node->references[i].isInverse)
17804  continue;
17805 
17806  /* Recurse only for valid reference types */
17807  for(size_t j = 0; j < referenceTypeIdsSize; ++j) {
17808  if(UA_NodeId_equal(&node->references[i].referenceTypeId, &referenceTypeIds[j]) &&
17809  isNodeInTree(ns, &node->references[i].targetId.nodeId, nodeToFind,
17810  referenceTypeIds, referenceTypeIdsSize))
17811  return true;
17812  }
17813  }
17814  return false;
17815 }
17816 
17817 const UA_Node *
17818 getNodeType(UA_Server *server, const UA_Node *node) {
17819  /* The reference to the parent is different for variable and variabletype */
17820  UA_NodeId parentRef;
17821  UA_Boolean inverse;
17822  if(node->nodeClass == UA_NODECLASS_VARIABLE ||
17823  node->nodeClass == UA_NODECLASS_OBJECT) {
17824  parentRef = UA_NODEID_NUMERIC(0, UA_NS0ID_HASTYPEDEFINITION);
17825  inverse = false;
17826  } else if(node->nodeClass == UA_NODECLASS_VARIABLETYPE ||
17827  /* node->nodeClass == UA_NODECLASS_OBJECTTYPE || // objecttype may have multiple parents */
17828  node->nodeClass == UA_NODECLASS_REFERENCETYPE ||
17829  node->nodeClass == UA_NODECLASS_DATATYPE) {
17830  parentRef = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
17831  inverse = true;
17832  } else {
17833  return NULL;
17834  }
17835 
17836  /* stop at the first matching candidate */
17837  UA_NodeId *parentId = NULL;
17838  for(size_t i = 0; i < node->referencesSize; ++i) {
17839  if(node->references[i].isInverse == inverse &&
17840  UA_NodeId_equal(&node->references[i].referenceTypeId, &parentRef)) {
17841  parentId = &node->references[i].targetId.nodeId;
17842  break;
17843  }
17844  }
17845 
17846  if(!parentId)
17847  return NULL;
17848  return UA_NodeStore_get(server->nodestore, parentId);
17849 }
17850 
17851 const UA_VariableTypeNode *
17852 getVariableNodeType(UA_Server *server, const UA_VariableNode *node) {
17853  const UA_Node *type = getNodeType(server, (const UA_Node*)node);
17854  if(!type || type->nodeClass != UA_NODECLASS_VARIABLETYPE)
17855  return NULL;
17856  return (const UA_VariableTypeNode*)type;
17857 }
17858 
17859 const UA_ObjectTypeNode *
17860 getObjectNodeType(UA_Server *server, const UA_ObjectNode *node) {
17861  const UA_Node *type = getNodeType(server, (const UA_Node*)node);
17862  if(type->nodeClass != UA_NODECLASS_OBJECTTYPE)
17863  return NULL;
17864  return (const UA_ObjectTypeNode*)type;
17865 }
17866 
17867 UA_Boolean
17868 UA_Node_hasSubTypeOrInstances(const UA_Node *node) {
17869  const UA_NodeId hasSubType = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
17870  const UA_NodeId hasTypeDefinition = UA_NODEID_NUMERIC(0, UA_NS0ID_HASTYPEDEFINITION);
17871  for(size_t i = 0; i < node->referencesSize; ++i) {
17872  if(node->references[i].isInverse == false &&
17873  UA_NodeId_equal(&node->references[i].referenceTypeId, &hasSubType))
17874  return true;
17875  if(node->references[i].isInverse == true &&
17876  UA_NodeId_equal(&node->references[i].referenceTypeId, &hasTypeDefinition))
17877  return true;
17878  }
17879  return false;
17880 }
17881 
17882 /* For mulithreading: make a copy of the node, edit and replace.
17883  * For singletrheading: edit the original */
17885 UA_Server_editNode(UA_Server *server, UA_Session *session,
17886  const UA_NodeId *nodeId, UA_EditNodeCallback callback,
17887  const void *data) {
17888 #ifndef UA_ENABLE_MULTITHREADING
17889  const UA_Node *node = UA_NodeStore_get(server->nodestore, nodeId);
17890  if(!node)
17892  UA_Node *editNode = (UA_Node*)(uintptr_t)node; // dirty cast
17893  return callback(server, session, editNode, data);
17894 #else
17895  UA_StatusCode retval;
17896  do {
17897  UA_Node *copy = UA_NodeStore_getCopy(server->nodestore, nodeId);
17898  if(!copy)
17900  retval = callback(server, session, copy, data);
17901  if(retval != UA_STATUSCODE_GOOD) {
17903  return retval;
17904  }
17905  retval = UA_NodeStore_replace(server->nodestore, copy);
17906  } while(retval != UA_STATUSCODE_GOOD);
17907  return UA_STATUSCODE_GOOD;
17908 #endif
17909 }
17910 
17911 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_server_worker.c" ***********************************/
17912 
17913 /* This Source Code Form is subject to the terms of the Mozilla Public
17914 * License, v. 2.0. If a copy of the MPL was not distributed with this
17915 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
17916 
17917 
17953 #define MAXTIMEOUT 50 // max timeout in millisec until the next main loop iteration
17954 
17955 static void
17956 processJob(UA_Server *server, UA_Job *job) {
17958  UA_RCU_LOCK();
17959  switch(job->type) {
17960  case UA_JOBTYPE_NOTHING:
17961  break;
17962  case UA_JOBTYPE_DETACHCONNECTION:
17964  break;
17965  case UA_JOBTYPE_BINARYMESSAGE_NETWORKLAYER:
17966  UA_Server_processBinaryMessage(server, job->job.binaryMessage.connection,
17967  &job->job.binaryMessage.message);
17968  UA_Connection *connection = job->job.binaryMessage.connection;
17969  connection->releaseRecvBuffer(connection, &job->job.binaryMessage.message);
17970  break;
17971  case UA_JOBTYPE_BINARYMESSAGE_ALLOCATED:
17972  UA_Server_processBinaryMessage(server, job->job.binaryMessage.connection,
17973  &job->job.binaryMessage.message);
17974  UA_ByteString_deleteMembers(&job->job.binaryMessage.message);
17975  break;
17976  case UA_JOBTYPE_METHODCALL:
17977  case UA_JOBTYPE_METHODCALL_DELAYED:
17978  job->job.methodCall.method(server, job->job.methodCall.data);
17979  break;
17980  default:
17981  UA_LOG_WARNING(server->config.logger, UA_LOGCATEGORY_SERVER,
17982  "Trying to execute a job of unknown type");
17983  break;
17984  }
17985  UA_RCU_UNLOCK();
17986 }
17987 
17988 /*******************************/
17989 /* Worker Threads and Dispatch */
17990 /*******************************/
17991 
17992 #ifdef UA_ENABLE_MULTITHREADING
17993 
17994 struct MainLoopJob {
17995  struct cds_lfs_node node;
17996  UA_Job job;
17997 };
17998 
17999 struct DispatchJob {
18000  struct cds_wfcq_node node; // node for the queue
18001  UA_Job job;
18002 };
18003 
18004 static void *
18005 workerLoop(UA_Worker *worker) {
18006  UA_Server *server = worker->server;
18007  UA_UInt32 *counter = &worker->counter;
18008  volatile UA_Boolean *running = &worker->running;
18009 
18010  /* Initialize the (thread local) random seed with the ram address of worker */
18011  UA_random_seed((uintptr_t)worker);
18012  rcu_register_thread();
18013 
18014  while(*running) {
18015  struct DispatchJob *dj = (struct DispatchJob*)
18016  cds_wfcq_dequeue_blocking(&server->dispatchQueue_head, &server->dispatchQueue_tail);
18017  if(dj) {
18018  processJob(server, &dj->job);
18019  UA_free(dj);
18020  } else {
18021  /* nothing to do. sleep until a job is dispatched (and wakes up all worker threads) */
18022  pthread_mutex_lock(&server->dispatchQueue_mutex);
18023  pthread_cond_wait(&server->dispatchQueue_condition, &server->dispatchQueue_mutex);
18024  pthread_mutex_unlock(&server->dispatchQueue_mutex);
18025  }
18026  UA_atomic_add(counter, 1);
18027  }
18028 
18030  rcu_barrier(); // wait for all scheduled call_rcu work to complete
18031  rcu_unregister_thread();
18032  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER, "Worker shut down");
18033  return NULL;
18034 }
18035 
18036 static void
18037 dispatchJob(UA_Server *server, const UA_Job *job) {
18038  struct DispatchJob *dj = UA_malloc(sizeof(struct DispatchJob));
18039  dj->job = *job;
18040  cds_wfcq_node_init(&dj->node);
18041  cds_wfcq_enqueue(&server->dispatchQueue_head, &server->dispatchQueue_tail, &dj->node);
18042 }
18043 
18044 static void
18045 emptyDispatchQueue(UA_Server *server) {
18046  while(!cds_wfcq_empty(&server->dispatchQueue_head, &server->dispatchQueue_tail)) {
18047  struct DispatchJob *dj = (struct DispatchJob*)
18048  cds_wfcq_dequeue_blocking(&server->dispatchQueue_head, &server->dispatchQueue_tail);
18049  processJob(server, &dj->job);
18050  UA_free(dj);
18051  }
18052 }
18053 
18054 #endif
18055 
18056 /*****************/
18057 /* Repeated Jobs */
18058 /*****************/
18059 
18060 /* The linked list of jobs is sorted according to the next execution timestamp */
18061 struct RepeatedJob {
18062  LIST_ENTRY(RepeatedJob) next; /* Next element in the list */
18063  UA_DateTime nextTime; /* The next time when the jobs are to be executed */
18064  UA_UInt64 interval; /* Interval in 100ns resolution */
18065  UA_Guid id; /* Id of the repeated job */
18066  UA_Job job; /* The job description itself */
18067 };
18068 
18069 /* internal. call only from the main loop. */
18070 static void
18071 addRepeatedJob(UA_Server *server, struct RepeatedJob * UA_RESTRICT rj) {
18072  /* Search for the best position on the repeatedJobs sorted list. The goal is
18073  * to have many repeated jobs with the same repetition interval in a
18074  * "block". This helps to reduce the (linear) search to find the next entry
18075  * in the repeatedJobs list when dispatching the repeated jobs.
18076  * For this, we search between "nexttime_max - 1s" and "nexttime_max" for
18077  * entries with the same repetition interval and adjust the "nexttime".
18078  * Otherwise, add entry after the first element before "nexttime_max". */
18079  UA_DateTime nextTime_max = UA_DateTime_nowMonotonic() + (UA_Int64) rj->interval;
18080 
18081  struct RepeatedJob *afterRj = NULL;
18082  struct RepeatedJob *tmpRj;
18083  LIST_FOREACH(tmpRj, &server->repeatedJobs, next) {
18084  if(tmpRj->nextTime >= nextTime_max)
18085  break;
18086  if(tmpRj->interval == rj->interval &&
18087  tmpRj->nextTime > (nextTime_max - UA_SEC_TO_DATETIME))
18088  nextTime_max = tmpRj->nextTime; /* break in the next iteration */
18089  afterRj = tmpRj;
18090  }
18091 
18092  /* add the repeated job */
18093  rj->nextTime = nextTime_max;
18094  if(afterRj)
18095  LIST_INSERT_AFTER(afterRj, rj, next);
18096  else
18097  LIST_INSERT_HEAD(&server->repeatedJobs, rj, next);
18098 }
18099 
18101 UA_Server_addRepeatedJob(UA_Server *server, UA_Job job,
18102  UA_UInt32 interval, UA_Guid *jobId) {
18103  /* the interval needs to be at least 5ms */
18104  if(interval < 5)
18106  UA_UInt64 interval_dt =
18107  (UA_UInt64)interval * (UA_UInt64)UA_MSEC_TO_DATETIME; // from ms to 100ns resolution
18108 
18109  /* Create and fill the repeated job structure */
18110  struct RepeatedJob *rj = UA_malloc(sizeof(struct RepeatedJob));
18111  if(!rj)
18113  /* done inside addRepeatedJob:
18114  * rj->nextTime = UA_DateTime_nowMonotonic() + interval_dt; */
18115  rj->interval = interval_dt;
18116  rj->id = UA_Guid_random();
18117  rj->job = job;
18118 
18119 #ifdef UA_ENABLE_MULTITHREADING
18120  /* Call addRepeatedJob from the main loop */
18121  struct MainLoopJob *mlw = UA_malloc(sizeof(struct MainLoopJob));
18122  if(!mlw) {
18123  UA_free(rj);
18125  }
18126  mlw->job = (UA_Job) {
18127  .type = UA_JOBTYPE_METHODCALL,
18128  .job.methodCall = {.data = rj, .method = (void (*)(UA_Server*, void*))addRepeatedJob}};
18129  cds_lfs_push(&server->mainLoopJobs, &mlw->node);
18130 #else
18131  /* Add directly */
18132  addRepeatedJob(server, rj);
18133 #endif
18134  if(jobId)
18135  *jobId = rj->id;
18136  return UA_STATUSCODE_GOOD;
18137 }
18138 
18139 /* - Dispatches all repeated jobs that have timed out
18140  * - Reinserts dispatched job at their new position in the sorted list
18141  * - Returns the next datetime when a repeated job is scheduled */
18142 static UA_DateTime
18143 processRepeatedJobs(UA_Server *server, UA_DateTime current, UA_Boolean *dispatched) {
18144  /* Keep pointer to the previously dispatched job to avoid linear search for
18145  * "batched" jobs with the same nexttime and interval */
18146  struct RepeatedJob tmp_last;
18147  tmp_last.nextTime = current-1; /* never matches. just to avoid if(last_added && ...) */
18148  struct RepeatedJob *last_dispatched = &tmp_last;
18149 
18150  /* Iterate over the list of elements (sorted according to the nextTime timestamp) */
18151  struct RepeatedJob *rj, *tmp_rj;
18152  LIST_FOREACH_SAFE(rj, &server->repeatedJobs, next, tmp_rj) {
18153  if(rj->nextTime > current)
18154  break;
18155 
18156  /* Dispatch/process job */
18157 #ifdef UA_ENABLE_MULTITHREADING
18158  dispatchJob(server, &rj->job);
18159  *dispatched = true;
18160 #else
18161  struct RepeatedJob **previousNext = rj->next.le_prev;
18162  processJob(server, &rj->job);
18163  /* See if the current job was deleted during processJob. That means the
18164  * le_next field of the previous repeated job (could also be the list
18165  * head) does no longer point to the current repeated job */
18166  if((void*)*previousNext != (void*)rj) {
18167  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER,
18168  "The current repeated job removed itself");
18169  tmp_rj = LIST_FIRST(&server->repeatedJobs);
18170  continue;
18171  }
18172 
18173  /* Was tmp_rj removed during the job? */
18174  if(LIST_NEXT(rj, next) != tmp_rj)
18175  tmp_rj = LIST_FIRST(&server->repeatedJobs);
18176 #endif
18177 
18178  /* Set the time for the next execution */
18179  rj->nextTime += (UA_Int64)rj->interval;
18180 
18181  /* Prevent an infinite loop when the repeated jobs took more time than
18182  * rj->interval */
18183  if(rj->nextTime < current)
18184  rj->nextTime = current + 1;
18185 
18186  /* Find new position for rj to keep the list sorted */
18187  struct RepeatedJob *prev_rj;
18188  if(last_dispatched->nextTime == rj->nextTime) {
18189  /* We "batch" repeatedJobs with the same interval in
18190  * addRepeatedJobs. So this might occur quite often. */
18191  UA_assert(last_dispatched != &tmp_last);
18192  prev_rj = last_dispatched;
18193  } else {
18194  /* Find the position by a linear search */
18195  prev_rj = LIST_FIRST(&server->repeatedJobs);
18196  while(true) {
18197  struct RepeatedJob *n = LIST_NEXT(prev_rj, next);
18198  if(!n || n->nextTime >= rj->nextTime)
18199  break;
18200  prev_rj = n;
18201  }
18202  }
18203 
18204  /* Add entry */
18205  if(prev_rj != rj) {
18206  LIST_REMOVE(rj, next);
18207  LIST_INSERT_AFTER(prev_rj, rj, next);
18208  }
18209 
18210  /* Update last_dispatched and loop */
18211  last_dispatched = rj;
18212  }
18213 
18214  /* Check if the next repeated job is sooner than the usual timeout */
18215  struct RepeatedJob *first = LIST_FIRST(&server->repeatedJobs);
18216  UA_DateTime next = current + (MAXTIMEOUT * UA_MSEC_TO_DATETIME);
18217  if(first && first->nextTime < next)
18218  next = first->nextTime;
18219  return next;
18220 }
18221 
18222 /* Call this function only from the main loop! */
18223 static void
18224 removeRepeatedJob(UA_Server *server, UA_Guid *jobId) {
18225  struct RepeatedJob *rj, *rj_tmp;
18226  LIST_FOREACH_SAFE(rj, &server->repeatedJobs, next, rj_tmp) {
18227  if(!UA_Guid_equal(jobId, &rj->id))
18228  continue;
18229  LIST_REMOVE(rj, next);
18230  UA_free(rj);
18231  break;
18232  }
18233 #ifdef UA_ENABLE_MULTITHREADING
18234  UA_free(jobId);
18235 #endif
18236 }
18237 
18239 #ifdef UA_ENABLE_MULTITHREADING
18240  UA_Guid *idptr = UA_malloc(sizeof(UA_Guid));
18241  if(!idptr)
18243  *idptr = jobId;
18244  // dispatch to the mainloopjobs stack
18245  struct MainLoopJob *mlw = UA_malloc(sizeof(struct MainLoopJob));
18246  mlw->job = (UA_Job) {
18247  .type = UA_JOBTYPE_METHODCALL,
18248  .job.methodCall = {.data = idptr, .method = (void (*)(UA_Server*, void*))removeRepeatedJob}};
18249  cds_lfs_push(&server->mainLoopJobs, &mlw->node);
18250 #else
18251  removeRepeatedJob(server, &jobId);
18252 #endif
18253  return UA_STATUSCODE_GOOD;
18254 }
18255 
18256 void UA_Server_deleteAllRepeatedJobs(UA_Server *server) {
18257  struct RepeatedJob *current, *temp;
18258  LIST_FOREACH_SAFE(current, &server->repeatedJobs, next, temp) {
18259  LIST_REMOVE(current, next);
18260  UA_free(current);
18261  }
18262 }
18263 
18264 /****************/
18265 /* Delayed Jobs */
18266 /****************/
18267 
18268 static void
18269 delayed_free(UA_Server *server, void *data) {
18270  UA_free(data);
18271 }
18272 
18273 UA_StatusCode UA_Server_delayedFree(UA_Server *server, void *data) {
18274  return UA_Server_delayedCallback(server, delayed_free, data);
18275 }
18276 
18277 #ifndef UA_ENABLE_MULTITHREADING
18278 
18279 typedef struct UA_DelayedJob {
18280  SLIST_ENTRY(UA_DelayedJob) next;
18281  UA_Job job;
18282 } UA_DelayedJob;
18283 
18285 UA_Server_delayedCallback(UA_Server *server, UA_ServerCallback callback, void *data) {
18286  UA_DelayedJob *dj = UA_malloc(sizeof(UA_DelayedJob));
18287  if(!dj)
18289  dj->job.type = UA_JOBTYPE_METHODCALL;
18290  dj->job.job.methodCall.data = data;
18291  dj->job.job.methodCall.method = callback;
18292  SLIST_INSERT_HEAD(&server->delayedCallbacks, dj, next);
18293  return UA_STATUSCODE_GOOD;
18294 }
18295 
18296 static void
18297 processDelayedCallbacks(UA_Server *server) {
18298  UA_DelayedJob *dj, *dj_tmp;
18299  SLIST_FOREACH_SAFE(dj, &server->delayedCallbacks, next, dj_tmp) {
18300  SLIST_REMOVE(&server->delayedCallbacks, dj, UA_DelayedJob, next);
18301  processJob(server, &dj->job);
18302  UA_free(dj);
18303  }
18304 }
18305 
18306 #else
18307 
18308 #define DELAYEDJOBSSIZE 100 // Collect delayed jobs until we have DELAYEDWORKSIZE items
18309 
18310 struct DelayedJobs {
18311  struct DelayedJobs *next;
18312  UA_UInt32 *workerCounters; // initially NULL until the counter are set
18313  UA_UInt32 jobsCount; // the size of the array is DELAYEDJOBSSIZE, the count may be less
18314  UA_Job jobs[DELAYEDJOBSSIZE]; // when it runs full, a new delayedJobs entry is created
18315 };
18316 
18317 /* Dispatched as an ordinary job when the DelayedJobs list is full */
18318 static void getCounters(UA_Server *server, struct DelayedJobs *delayed) {
18319  UA_UInt32 *counters = UA_malloc(server->config.nThreads * sizeof(UA_UInt32));
18320  for(UA_UInt16 i = 0; i < server->config.nThreads; ++i)
18321  counters[i] = server->workers[i].counter;
18322  delayed->workerCounters = counters;
18323 }
18324 
18325 /* Call from the main thread only. This is the only function that modifies */
18326 /* server->delayedWork. processDelayedWorkQueue modifies the "next" (after the */
18327 /* head). */
18328 static void
18329 addDelayedJob(UA_Server *server, UA_Job *job) {
18330  struct DelayedJobs *dj = server->delayedJobs;
18331  if(!dj || dj->jobsCount >= DELAYEDJOBSSIZE) {
18332  /* create a new DelayedJobs and add it to the linked list */
18333  dj = UA_malloc(sizeof(struct DelayedJobs));
18334  if(!dj) {
18335  UA_LOG_ERROR(server->config.logger, UA_LOGCATEGORY_SERVER,
18336  "Not enough memory to add a delayed job");
18337  return;
18338  }
18339  dj->jobsCount = 0;
18340  dj->workerCounters = NULL;
18341  dj->next = server->delayedJobs;
18342  server->delayedJobs = dj;
18343 
18344  /* dispatch a method that sets the counter for the full list that comes afterwards */
18345  if(dj->next) {
18346  UA_Job setCounter = (UA_Job){
18347  .type = UA_JOBTYPE_METHODCALL, .job.methodCall =
18348  {.method = (void (*)(UA_Server*, void*))getCounters, .data = dj->next}};
18349  dispatchJob(server, &setCounter);
18350  }
18351  }
18352  dj->jobs[dj->jobsCount] = *job;
18353  ++dj->jobsCount;
18354 }
18355 
18356 static void
18357 addDelayedJobAsync(UA_Server *server, UA_Job *job) {
18358  addDelayedJob(server, job);
18359  UA_free(job);
18360 }
18361 
18363 UA_Server_delayedCallback(UA_Server *server, UA_ServerCallback callback, void *data) {
18364  UA_Job *j = UA_malloc(sizeof(UA_Job));
18365  if(!j)
18367  j->type = UA_JOBTYPE_METHODCALL;
18368  j->job.methodCall.data = data;
18369  j->job.methodCall.method = callback;
18370  struct MainLoopJob *mlw = UA_malloc(sizeof(struct MainLoopJob));
18371  mlw->job = (UA_Job) {.type = UA_JOBTYPE_METHODCALL, .job.methodCall =
18372  {.data = j, .method = (UA_ServerCallback)addDelayedJobAsync}};
18373  cds_lfs_push(&server->mainLoopJobs, &mlw->node);
18374  return UA_STATUSCODE_GOOD;
18375 }
18376 
18377 /* Find out which delayed jobs can be executed now */
18378 static void
18379 dispatchDelayedJobs(UA_Server *server, void *_) {
18380  /* start at the second */
18381  struct DelayedJobs *dw = server->delayedJobs, *beforedw = dw;
18382  if(dw)
18383  dw = dw->next;
18384 
18385  /* find the first delayedwork where the counters have been set and have moved */
18386  while(dw) {
18387  if(!dw->workerCounters) {
18388  beforedw = dw;
18389  dw = dw->next;
18390  continue;
18391  }
18392  UA_Boolean allMoved = true;
18393  for(size_t i = 0; i < server->config.nThreads; ++i) {
18394  if(dw->workerCounters[i] == server->workers[i].counter) {
18395  allMoved = false;
18396  break;
18397  }
18398  }
18399  if(allMoved)
18400  break;
18401  beforedw = dw;
18402  dw = dw->next;
18403  }
18404 
18405  /* process and free all delayed jobs from here on */
18406  while(dw) {
18407  for(size_t i = 0; i < dw->jobsCount; ++i)
18408  processJob(server, &dw->jobs[i]);
18409  struct DelayedJobs *next = UA_atomic_xchg((void**)&beforedw->next, NULL);
18410  UA_free(dw->workerCounters);
18411  UA_free(dw);
18412  dw = next;
18413  }
18414 }
18415 
18416 #endif
18417 
18418 /********************/
18419 /* Main Server Loop */
18420 /********************/
18421 
18422 #ifdef UA_ENABLE_MULTITHREADING
18423 static void processMainLoopJobs(UA_Server *server) {
18424  /* no synchronization required if we only use push and pop_all */
18425  struct cds_lfs_head *head = __cds_lfs_pop_all(&server->mainLoopJobs);
18426  if(!head)
18427  return;
18428  struct MainLoopJob *mlw = (struct MainLoopJob*)&head->node;
18429  struct MainLoopJob *next;
18430  do {
18431  processJob(server, &mlw->job);
18432  next = (struct MainLoopJob*)mlw->node.next;
18433  UA_free(mlw);
18434  //cppcheck-suppress unreadVariable
18435  } while((mlw = next));
18436 }
18437 #endif
18438 
18440 #ifdef UA_ENABLE_MULTITHREADING
18441  /* Spin up the worker threads */
18442  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
18443  "Spinning up %u worker thread(s)", server->config.nThreads);
18444  pthread_cond_init(&server->dispatchQueue_condition, 0);
18445  pthread_mutex_init(&server->dispatchQueue_mutex, 0);
18446  server->workers = UA_malloc(server->config.nThreads * sizeof(UA_Worker));
18447  if(!server->workers)
18449  for(size_t i = 0; i < server->config.nThreads; ++i) {
18450  UA_Worker *worker = &server->workers[i];
18451  worker->server = server;
18452  worker->counter = 0;
18453  worker->running = true;
18454  pthread_create(&worker->thr, NULL, (void* (*)(void*))workerLoop, worker);
18455  }
18456 
18457  /* Try to execute delayed callbacks every 10 sec */
18458  UA_Job processDelayed = {.type = UA_JOBTYPE_METHODCALL,
18459  .job.methodCall = {.method = dispatchDelayedJobs, .data = NULL} };
18460  UA_Server_addRepeatedJob(server, processDelayed, 10000, NULL);
18461 #endif
18462 
18463  /* Start the networklayers */
18465  for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
18466  UA_ServerNetworkLayer *nl = &server->config.networkLayers[i];
18467  result |= nl->start(nl, server->config.logger);
18468  }
18469 
18470  return result;
18471 }
18472 
18473 /* completeMessages is run synchronous on the jobs returned from the network
18474  layer, so that the order for processing TCP packets is never mixed up. */
18475 static void
18476 completeMessages(UA_Server *server, UA_Job *job) {
18477  UA_Boolean realloced = UA_FALSE;
18479  &job->job.binaryMessage.message, &realloced);
18480  if(retval != UA_STATUSCODE_GOOD) {
18481  if(retval == UA_STATUSCODE_BADOUTOFMEMORY)
18482  UA_LOG_WARNING(server->config.logger, UA_LOGCATEGORY_NETWORK,
18483  "Lost message(s) from Connection %i as memory could not be allocated",
18484  job->job.binaryMessage.connection->sockfd);
18485  else if(retval != UA_STATUSCODE_GOOD)
18486  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_NETWORK,
18487  "Could not merge half-received messages on Connection %i with error 0x%08x",
18488  job->job.binaryMessage.connection->sockfd, retval);
18489  job->type = UA_JOBTYPE_NOTHING;
18490  return;
18491  }
18492  if(realloced)
18493  job->type = UA_JOBTYPE_BINARYMESSAGE_ALLOCATED;
18494 
18495  /* discard the job if message is empty - also no leak is possible here */
18496  if(job->job.binaryMessage.message.length == 0)
18497  job->type = UA_JOBTYPE_NOTHING;
18498 }
18499 
18500 UA_UInt16 UA_Server_run_iterate(UA_Server *server, UA_Boolean waitInternal) {
18501 #ifdef UA_ENABLE_MULTITHREADING
18502  /* Run work assigned for the main thread */
18503  processMainLoopJobs(server);
18504 #endif
18505  /* Process repeated work */
18507  UA_Boolean dispatched = false; /* to wake up worker threads */
18508  UA_DateTime nextRepeated = processRepeatedJobs(server, now, &dispatched);
18509 
18510  UA_UInt16 timeout = 0;
18511  if(waitInternal)
18512  timeout = (UA_UInt16)((nextRepeated - now) / UA_MSEC_TO_DATETIME);
18513 
18514  /* Get work from the networklayer */
18515  for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
18516  UA_ServerNetworkLayer *nl = &server->config.networkLayers[i];
18517  UA_Job *jobs = NULL;
18518  size_t jobsSize;
18519  /* only the last networklayer waits on the tieout */
18520  if(i == server->config.networkLayersSize-1)
18521  jobsSize = nl->getJobs(nl, &jobs, timeout);
18522  else
18523  jobsSize = nl->getJobs(nl, &jobs, 0);
18524 
18525  for(size_t k = 0; k < jobsSize; ++k) {
18526 #ifdef UA_ENABLE_MULTITHREADING
18527  /* Filter out delayed work */
18528  if(jobs[k].type == UA_JOBTYPE_METHODCALL_DELAYED) {
18529  addDelayedJob(server, &jobs[k]);
18530  jobs[k].type = UA_JOBTYPE_NOTHING;
18531  continue;
18532  }
18533 #endif
18534  /* Merge half-received messages */
18535  if(jobs[k].type == UA_JOBTYPE_BINARYMESSAGE_NETWORKLAYER)
18536  completeMessages(server, &jobs[k]);
18537  }
18538 
18539  /* Dispatch/process jobs */
18540  for(size_t j = 0; j < jobsSize; ++j) {
18541 #ifdef UA_ENABLE_MULTITHREADING
18542  dispatchJob(server, &jobs[j]);
18543  dispatched = true;
18544 #else
18545  processJob(server, &jobs[j]);
18546 #endif
18547  }
18548 
18549  /* Clean up jobs list */
18550  if(jobsSize > 0)
18551  UA_free(jobs);
18552  }
18553 
18554 #ifdef UA_ENABLE_MULTITHREADING
18555  /* Wake up worker threads */
18556  if(dispatched)
18557  pthread_cond_broadcast(&server->dispatchQueue_condition);
18558 #else
18559  processDelayedCallbacks(server);
18560 #endif
18561 
18562  now = UA_DateTime_nowMonotonic();
18563  timeout = 0;
18564  if(nextRepeated > now)
18565  timeout = (UA_UInt16)((nextRepeated - now) / UA_MSEC_TO_DATETIME);
18566  return timeout;
18567 }
18568 
18570  for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
18571  UA_ServerNetworkLayer *nl = &server->config.networkLayers[i];
18572  UA_Job *stopJobs = NULL;
18573  size_t stopJobsSize = nl->stop(nl, &stopJobs);
18574  for(size_t j = 0; j < stopJobsSize; ++j)
18575  processJob(server, &stopJobs[j]);
18576  UA_free(stopJobs);
18577  }
18578 
18579 #ifdef UA_ENABLE_MULTITHREADING
18580  /* Ensure that run_shutdown can be called multiple times */
18581  if(server->workers) {
18582  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
18583  "Shutting down %u worker thread(s)", server->config.nThreads);
18584  /* Wait for all worker threads to finish */
18585  for(size_t i = 0; i < server->config.nThreads; ++i)
18586  server->workers[i].running = false;
18587  pthread_cond_broadcast(&server->dispatchQueue_condition);
18588  for(size_t i = 0; i < server->config.nThreads; ++i)
18589  pthread_join(server->workers[i].thr, NULL);
18590  /* Free the worker structures */
18591  UA_free(server->workers);
18592  server->workers = NULL;
18593  }
18594 
18595  /* Manually finish the work still enqueued */
18596  emptyDispatchQueue(server);
18598  rcu_barrier(); // wait for all scheduled call_rcu work to complete
18599 #else
18600  processDelayedCallbacks(server);
18601 #endif
18602  return UA_STATUSCODE_GOOD;
18603 }
18604 
18605 UA_StatusCode UA_Server_run(UA_Server *server, volatile UA_Boolean *running) {
18606  UA_StatusCode retval = UA_Server_run_startup(server);
18607  if(retval != UA_STATUSCODE_GOOD)
18608  return retval;
18609  while(*running)
18610  UA_Server_run_iterate(server, true);
18611  return UA_Server_run_shutdown(server);
18612 }
18613 
18614 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_securechannel_manager.c" ***********************************/
18615 
18616 /* This Source Code Form is subject to the terms of the Mozilla Public
18617 * License, v. 2.0. If a copy of the MPL was not distributed with this
18618 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
18619 
18620 
18621 #define STARTCHANNELID 1
18622 #define STARTTOKENID 1
18623 
18626  LIST_INIT(&cm->channels);
18627  cm->lastChannelId = STARTCHANNELID;
18628  cm->lastTokenId = STARTTOKENID;
18629  cm->currentChannelCount = 0;
18630  cm->server = server;
18631  return UA_STATUSCODE_GOOD;
18632 }
18633 
18635  channel_list_entry *entry, *temp;
18636  LIST_FOREACH_SAFE(entry, &cm->channels, pointers, temp) {
18637  LIST_REMOVE(entry, pointers);
18639  UA_free(entry);
18640  }
18641 }
18642 
18643 static void
18644 removeSecureChannelCallback(UA_Server *server, void *entry) {
18645  channel_list_entry *centry = (channel_list_entry*)entry;
18647  UA_free(entry);
18648 }
18649 
18650 static UA_StatusCode
18651 removeSecureChannel(UA_SecureChannelManager *cm, channel_list_entry *entry){
18652  /* Add a delayed callback to remove the channel when the currently
18653  * scheduled jobs have completed */
18654  UA_StatusCode retval = UA_Server_delayedCallback(cm->server, removeSecureChannelCallback, entry);
18655  if(retval != UA_STATUSCODE_GOOD) {
18656  UA_LOG_WARNING(cm->server->config.logger, UA_LOGCATEGORY_SESSION,
18657  "Could not remove the secure channel with error code %s",
18658  UA_StatusCode_name(retval));
18659  return retval; /* Try again next time */
18660  }
18661 
18662  /* Detach the channel and make the capacity available */
18663  LIST_REMOVE(entry, pointers);
18664  UA_atomic_add(&cm->currentChannelCount, (UA_UInt32)-1);
18665  return UA_STATUSCODE_GOOD;
18666 }
18667 
18668 /* remove channels that were not renewed or who have no connection attached */
18669 void
18671  channel_list_entry *entry, *temp;
18672  LIST_FOREACH_SAFE(entry, &cm->channels, pointers, temp) {
18673  UA_DateTime timeout = entry->channel.securityToken.createdAt +
18675  if(timeout < nowMonotonic || !entry->channel.connection) {
18676  UA_LOG_INFO_CHANNEL(cm->server->config.logger, &entry->channel,
18677  "SecureChannel has timed out");
18678  removeSecureChannel(cm, entry);
18679  } else if(entry->channel.nextSecurityToken.tokenId > 0) {
18681  }
18682  }
18683 }
18684 
18685 /* remove the first channel that has no session attached */
18686 static UA_Boolean purgeFirstChannelWithoutSession(UA_SecureChannelManager *cm) {
18687  channel_list_entry *entry;
18688  LIST_FOREACH(entry, &cm->channels, pointers) {
18689  if(LIST_EMPTY(&(entry->channel.sessions))){
18690  UA_LOG_DEBUG_CHANNEL(cm->server->config.logger, &entry->channel,
18691  "Channel was purged since maxSecureChannels was "
18692  "reached and channel had no session attached");
18693  removeSecureChannel(cm, entry);
18694  UA_assert(entry != LIST_FIRST(&cm->channels));
18695  return true;
18696  }
18697  }
18698  return false;
18699 }
18700 
18703  const UA_OpenSecureChannelRequest *request,
18704  UA_OpenSecureChannelResponse *response) {
18707 
18708  //check if there exists a free SC, otherwise try to purge one SC without a session
18709  //the purge has been introduced to pass CTT, it is not clear what strategy is expected here
18710  if(cm->currentChannelCount >= cm->server->config.maxSecureChannels && !purgeFirstChannelWithoutSession(cm)){
18712  }
18713 
18714  /* Set up the channel */
18716  if(!entry)
18718  UA_SecureChannel_init(&entry->channel);
18719  entry->channel.securityToken.channelId = cm->lastChannelId++;
18720  entry->channel.securityToken.tokenId = cm->lastTokenId++;
18723  (request->requestedLifetime > cm->server->config.maxSecurityTokenLifetime) ?
18724  cm->server->config.maxSecurityTokenLifetime : request->requestedLifetime;
18725  if(entry->channel.securityToken.revisedLifetime == 0) /* lifetime 0 -> set the maximum possible */
18726  entry->channel.securityToken.revisedLifetime = cm->server->config.maxSecurityTokenLifetime;
18727  UA_ByteString_copy(&request->clientNonce, &entry->channel.clientNonce);
18729  UA_STRING_ALLOC("http://opcfoundation.org/UA/SecurityPolicy#None");
18731 
18732  /* Set the response */
18733  UA_ByteString_copy(&entry->channel.serverNonce, &response->serverNonce);
18734  UA_ChannelSecurityToken_copy(&entry->channel.securityToken, &response->securityToken);
18736 
18737  /* Now overwrite the creation date with the internal monotonic clock */
18739 
18740  /* Set all the pointers internally */
18742  LIST_INSERT_HEAD(&cm->channels, entry, pointers);
18743  UA_atomic_add(&cm->currentChannelCount, 1);
18744  return UA_STATUSCODE_GOOD;
18745 }
18746 
18749  const UA_OpenSecureChannelRequest *request,
18750  UA_OpenSecureChannelResponse *response) {
18751  UA_SecureChannel *channel = conn->channel;
18752  if(!channel)
18754 
18755  /* if no security token is already issued */
18756  if(channel->nextSecurityToken.tokenId == 0) {
18757  channel->nextSecurityToken.channelId = channel->securityToken.channelId;
18758  channel->nextSecurityToken.tokenId = cm->lastTokenId++;
18761  (request->requestedLifetime > cm->server->config.maxSecurityTokenLifetime) ?
18762  cm->server->config.maxSecurityTokenLifetime : request->requestedLifetime;
18763  if(channel->nextSecurityToken.revisedLifetime == 0) /* lifetime 0 -> return the max lifetime */
18764  channel->nextSecurityToken.revisedLifetime = cm->server->config.maxSecurityTokenLifetime;
18765  }
18766 
18767  /* invalidate the old nonce */
18768  if(channel->clientNonce.data)
18769  UA_ByteString_deleteMembers(&channel->clientNonce);
18770 
18771  /* set the response */
18772  UA_ByteString_copy(&request->clientNonce, &channel->clientNonce);
18773  UA_ByteString_copy(&channel->serverNonce, &response->serverNonce);
18774  UA_ChannelSecurityToken_copy(&channel->nextSecurityToken, &response->securityToken);
18775 
18776  /* reset the creation date to the monotonic clock */
18778 
18779  return UA_STATUSCODE_GOOD;
18780 }
18781 
18784  channel_list_entry *entry;
18785  LIST_FOREACH(entry, &cm->channels, pointers) {
18786  if(entry->channel.securityToken.channelId == channelId)
18787  return &entry->channel;
18788  }
18789  return NULL;
18790 }
18791 
18794  channel_list_entry *entry;
18795  LIST_FOREACH(entry, &cm->channels, pointers) {
18796  if(entry->channel.securityToken.channelId == channelId)
18797  break;
18798  }
18799  if(!entry)
18801  return removeSecureChannel(cm, entry);
18802 }
18803 
18804 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_session_manager.c" ***********************************/
18805 
18806 /* This Source Code Form is subject to the terms of the Mozilla Public
18807 * License, v. 2.0. If a copy of the MPL was not distributed with this
18808 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
18809 
18810 
18813  LIST_INIT(&sm->sessions);
18814  sm->currentSessionCount = 0;
18815  sm->server = server;
18816  return UA_STATUSCODE_GOOD;
18817 }
18818 
18820  session_list_entry *current, *temp;
18821  LIST_FOREACH_SAFE(current, &sm->sessions, pointers, temp) {
18822  LIST_REMOVE(current, pointers);
18823  UA_Session_deleteMembersCleanup(&current->session, sm->server);
18824  UA_free(current);
18825  }
18826 }
18827 
18828 /* Delayed callback to free the session memory */
18829 static void
18830 removeSessionCallback(UA_Server *server, void *entry) {
18831  session_list_entry *sentry = (session_list_entry*)entry;
18832  UA_Session_deleteMembersCleanup(&sentry->session, server);
18833  UA_free(sentry);
18834 }
18835 
18836 static UA_StatusCode
18837 removeSession(UA_SessionManager *sm, session_list_entry *sentry) {
18838  /* Deactivate the session */
18839  sentry->session.activated = false;
18840 
18841  /* Add a delayed callback to remove the session when the currently
18842  * scheduled jobs have completed */
18843  UA_StatusCode retval = UA_Server_delayedCallback(sm->server, removeSessionCallback, sentry);
18844  if(retval != UA_STATUSCODE_GOOD) {
18845  UA_LOG_WARNING_SESSION(sm->server->config.logger, &sentry->session,
18846  "Could not remove session with error code %s",
18847  UA_StatusCode_name(retval));
18848  return retval; /* Try again next time */
18849  }
18850 
18851  /* Detach the session and make the capacity available */
18852  LIST_REMOVE(sentry, pointers);
18853  UA_atomic_add(&sm->currentSessionCount, (UA_UInt32)-1);
18854  return UA_STATUSCODE_GOOD;
18855 }
18856 
18857 void
18859  UA_DateTime nowMonotonic) {
18860  session_list_entry *sentry, *temp;
18861  LIST_FOREACH_SAFE(sentry, &sm->sessions, pointers, temp) {
18862  /* Session has timed out? */
18863  if(sentry->session.validTill >= nowMonotonic)
18864  continue;
18865  UA_LOG_INFO_SESSION(sm->server->config.logger, &sentry->session,
18866  "Session has timed out");
18867  removeSession(sm, sentry);
18868  }
18869 }
18870 
18871 UA_Session *
18873  session_list_entry *current = NULL;
18874  LIST_FOREACH(current, &sm->sessions, pointers) {
18875  /* Token does not match */
18876  if(!UA_NodeId_equal(&current->session.authenticationToken, token))
18877  continue;
18878 
18879  /* Session has timed out */
18880  if(UA_DateTime_nowMonotonic() > current->session.validTill) {
18881  UA_LOG_INFO_SESSION(sm->server->config.logger, &current->session,
18882  "Client tries to use a session that has timed out");
18883  return NULL;
18884  }
18885 
18886  /* Ok, return */
18887  return &current->session;
18888  }
18889 
18890  /* Session not found */
18891  UA_LOG_INFO(sm->server->config.logger, UA_LOGCATEGORY_SESSION,
18892  "Try to use Session with token " UA_PRINTF_GUID_FORMAT " but is not found",
18894  return NULL;
18895 }
18896 
18897 /* Creates and adds a session. But it is not yet attached to a secure channel. */
18900  const UA_CreateSessionRequest *request, UA_Session **session) {
18901  if(sm->currentSessionCount >= sm->server->config.maxSessions)
18903 
18904  session_list_entry *newentry = UA_malloc(sizeof(session_list_entry));
18905  if(!newentry)
18907 
18908  UA_atomic_add(&sm->currentSessionCount, 1);
18909  UA_Session_init(&newentry->session);
18910  newentry->session.sessionId = UA_NODEID_GUID(1, UA_Guid_random());
18911  newentry->session.authenticationToken = UA_NODEID_GUID(1, UA_Guid_random());
18912 
18913  if(request->requestedSessionTimeout <= sm->server->config.maxSessionTimeout &&
18914  request->requestedSessionTimeout > 0)
18915  newentry->session.timeout = request->requestedSessionTimeout;
18916  else
18917  newentry->session.timeout = sm->server->config.maxSessionTimeout;
18918 
18919  UA_Session_updateLifetime(&newentry->session);
18920  LIST_INSERT_HEAD(&sm->sessions, newentry, pointers);
18921  *session = &newentry->session;
18922  return UA_STATUSCODE_GOOD;
18923 }
18924 
18927  session_list_entry *current;
18928  LIST_FOREACH(current, &sm->sessions, pointers) {
18929  if(UA_NodeId_equal(&current->session.authenticationToken, token))
18930  break;
18931  }
18932  if(!current)
18934  return removeSession(sm, current);
18935 }
18936 
18937 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_nodes.c" ***********************************/
18938 
18939 /* This Source Code Form is subject to the terms of the Mozilla Public
18940 * License, v. 2.0. If a copy of the MPL was not distributed with this
18941 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
18942 
18943 
18945  /* delete standard content */
18946  UA_NodeId_deleteMembers(&node->nodeId);
18947  UA_QualifiedName_deleteMembers(&node->browseName);
18948  UA_LocalizedText_deleteMembers(&node->displayName);
18949  UA_LocalizedText_deleteMembers(&node->description);
18950  UA_Array_delete(node->references, node->referencesSize,
18952  node->references = NULL;
18953  node->referencesSize = 0;
18954 
18955  /* delete unique content of the nodeclass */
18956  switch(node->nodeClass) {
18957  case UA_NODECLASS_OBJECT:
18958  break;
18959  case UA_NODECLASS_METHOD:
18960  break;
18962  break;
18963  case UA_NODECLASS_VARIABLE:
18965  UA_VariableNode *p = (UA_VariableNode*)node;
18966  UA_NodeId_deleteMembers(&p->dataType);
18967  UA_Array_delete(p->arrayDimensions, p->arrayDimensionsSize,
18969  p->arrayDimensions = NULL;
18970  p->arrayDimensionsSize = 0;
18971  if(p->valueSource == UA_VALUESOURCE_DATA)
18972  UA_DataValue_deleteMembers(&p->value.data.value);
18973  break;
18974  }
18977  UA_LocalizedText_deleteMembers(&p->inverseName);
18978  break;
18979  }
18980  case UA_NODECLASS_DATATYPE:
18981  break;
18982  case UA_NODECLASS_VIEW:
18983  break;
18984  default:
18985  break;
18986  }
18987 }
18988 
18989 static UA_StatusCode
18990 UA_ObjectNode_copy(const UA_ObjectNode *src, UA_ObjectNode *dst) {
18991  dst->eventNotifier = src->eventNotifier;
18992  dst->instanceHandle = src->instanceHandle;
18993  return UA_STATUSCODE_GOOD;
18994 }
18995 
18996 static UA_StatusCode
18997 UA_CommonVariableNode_copy(const UA_VariableNode *src, UA_VariableNode *dst) {
18998  UA_StatusCode retval = UA_Array_copy(src->arrayDimensions,
18999  src->arrayDimensionsSize,
19000  (void**)&dst->arrayDimensions,
19002  if(retval != UA_STATUSCODE_GOOD)
19003  return retval;
19004  dst->arrayDimensionsSize = src->arrayDimensionsSize;
19005  retval = UA_NodeId_copy(&src->dataType, &dst->dataType);
19006  dst->valueRank = src->valueRank;
19007  dst->valueSource = src->valueSource;
19008  if(src->valueSource == UA_VALUESOURCE_DATA) {
19009  retval |= UA_DataValue_copy(&src->value.data.value,
19010  &dst->value.data.value);
19011  dst->value.data.callback = src->value.data.callback;
19012  } else
19013  dst->value.dataSource = src->value.dataSource;
19014  return retval;
19015 }
19016 
19017 static UA_StatusCode
19018 UA_VariableNode_copy(const UA_VariableNode *src, UA_VariableNode *dst) {
19019  UA_StatusCode retval = UA_CommonVariableNode_copy(src, dst);
19020  dst->accessLevel = src->accessLevel;
19021  dst->userAccessLevel = src->userAccessLevel;
19023  dst->historizing = src->historizing;
19024  return retval;
19025 }
19026 
19027 static UA_StatusCode
19028 UA_VariableTypeNode_copy(const UA_VariableTypeNode *src,
19029  UA_VariableTypeNode *dst) {
19030  UA_StatusCode retval = UA_CommonVariableNode_copy((const UA_VariableNode*)src,
19031  (UA_VariableNode*)dst);
19032  dst->isAbstract = src->isAbstract;
19033  return retval;
19034 }
19035 
19036 static UA_StatusCode
19037 UA_MethodNode_copy(const UA_MethodNode *src, UA_MethodNode *dst) {
19038  dst->executable = src->executable;
19039  dst->userExecutable = src->userExecutable;
19040  dst->methodHandle = src->methodHandle;
19041  dst->attachedMethod = src->attachedMethod;
19042  return UA_STATUSCODE_GOOD;
19043 }
19044 
19045 static UA_StatusCode
19046 UA_ObjectTypeNode_copy(const UA_ObjectTypeNode *src, UA_ObjectTypeNode *dst) {
19047  dst->isAbstract = src->isAbstract;
19049  return UA_STATUSCODE_GOOD;
19050 }
19051 
19052 static UA_StatusCode
19053 UA_ReferenceTypeNode_copy(const UA_ReferenceTypeNode *src,
19054  UA_ReferenceTypeNode *dst) {
19055  UA_StatusCode retval = UA_LocalizedText_copy(&src->inverseName,
19056  &dst->inverseName);
19057  dst->isAbstract = src->isAbstract;
19058  dst->symmetric = src->symmetric;
19059  return retval;
19060 }
19061 
19062 static UA_StatusCode
19063 UA_DataTypeNode_copy(const UA_DataTypeNode *src, UA_DataTypeNode *dst) {
19064  dst->isAbstract = src->isAbstract;
19065  return UA_STATUSCODE_GOOD;
19066 }
19067 
19068 static UA_StatusCode
19069 UA_ViewNode_copy(const UA_ViewNode *src, UA_ViewNode *dst) {
19070  dst->containsNoLoops = src->containsNoLoops;
19071  dst->eventNotifier = src->eventNotifier;
19072  return UA_STATUSCODE_GOOD;
19073 }
19074 
19075 UA_StatusCode UA_Node_copyAnyNodeClass(const UA_Node *src, UA_Node *dst) {
19076  if(src->nodeClass != dst->nodeClass)
19078 
19079  /* copy standard content */
19080  UA_StatusCode retval = UA_NodeId_copy(&src->nodeId, &dst->nodeId);
19081  dst->nodeClass = src->nodeClass;
19082  retval |= UA_QualifiedName_copy(&src->browseName, &dst->browseName);
19083  retval |= UA_LocalizedText_copy(&src->displayName, &dst->displayName);
19084  retval |= UA_LocalizedText_copy(&src->description, &dst->description);
19085  dst->writeMask = src->writeMask;
19086  dst->userWriteMask = src->userWriteMask;
19087  if(retval != UA_STATUSCODE_GOOD) {
19089  return retval;
19090  }
19091  retval |= UA_Array_copy(src->references, src->referencesSize,
19092  (void**)&dst->references,
19094  if(retval != UA_STATUSCODE_GOOD) {
19096  return retval;
19097  }
19098  dst->referencesSize = src->referencesSize;
19099 
19100  /* copy unique content of the nodeclass */
19101  switch(src->nodeClass) {
19102  case UA_NODECLASS_OBJECT:
19103  retval = UA_ObjectNode_copy((const UA_ObjectNode*)src,
19104  (UA_ObjectNode*)dst);
19105  break;
19106  case UA_NODECLASS_VARIABLE:
19107  retval = UA_VariableNode_copy((const UA_VariableNode*)src,
19108  (UA_VariableNode*)dst);
19109  break;
19110  case UA_NODECLASS_METHOD:
19111  retval = UA_MethodNode_copy((const UA_MethodNode*)src,
19112  (UA_MethodNode*)dst);
19113  break;
19115  retval = UA_ObjectTypeNode_copy((const UA_ObjectTypeNode*)src,
19116  (UA_ObjectTypeNode*)dst);
19117  break;
19119  retval = UA_VariableTypeNode_copy((const UA_VariableTypeNode*)src,
19120  (UA_VariableTypeNode*)dst);
19121  break;
19123  retval = UA_ReferenceTypeNode_copy((const UA_ReferenceTypeNode*)src,
19124  (UA_ReferenceTypeNode*)dst);
19125  break;
19126  case UA_NODECLASS_DATATYPE:
19127  retval = UA_DataTypeNode_copy((const UA_DataTypeNode*)src,
19128  (UA_DataTypeNode*)dst);
19129  break;
19130  case UA_NODECLASS_VIEW:
19131  retval = UA_ViewNode_copy((const UA_ViewNode*)src, (UA_ViewNode*)dst);
19132  break;
19133  default:
19134  break;
19135  }
19136 
19137  if(retval != UA_STATUSCODE_GOOD)
19139 
19140  return retval;
19141 }
19142 
19143 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_nodestore.c" ***********************************/
19144 
19145 /* This Source Code Form is subject to the terms of the Mozilla Public
19146 * License, v. 2.0. If a copy of the MPL was not distributed with this
19147 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
19148 
19149 
19150 #ifndef UA_ENABLE_MULTITHREADING /* conditional compilation */
19151 
19152 #define UA_NODESTORE_MINSIZE 64
19153 
19154 typedef struct UA_NodeStoreEntry {
19155  struct UA_NodeStoreEntry *orig; // the version this is a copy from (or NULL)
19156  UA_Node node;
19158 
19159 #define UA_NODESTORE_TOMBSTONE ((UA_NodeStoreEntry*)0x01)
19160 
19166 };
19167 
19168 /* The size of the hash-map is always a prime number. They are chosen to be
19169  * close to the next power of 2. So the size ca. doubles with each prime. */
19170 static UA_UInt32 const primes[] = {
19171  7, 13, 31, 61, 127, 251,
19172  509, 1021, 2039, 4093, 8191, 16381,
19173  32749, 65521, 131071, 262139, 524287, 1048573,
19174  2097143, 4194301, 8388593, 16777213, 33554393, 67108859,
19175  134217689, 268435399, 536870909, 1073741789, 2147483647, 4294967291
19176 };
19177 
19178 static UA_UInt32 mod(UA_UInt32 h, UA_UInt32 size) { return h % size; }
19179 static UA_UInt32 mod2(UA_UInt32 h, UA_UInt32 size) { return 1 + (h % (size - 2)); }
19180 
19181 static UA_UInt16
19182 higher_prime_index(UA_UInt32 n) {
19183  UA_UInt16 low = 0;
19184  UA_UInt16 high = (UA_UInt16)(sizeof(primes) / sizeof(UA_UInt32));
19185  while(low != high) {
19186  UA_UInt16 mid = (UA_UInt16)(low + ((high - low) / 2));
19187  if(n > primes[mid])
19188  low = (UA_UInt16)(mid + 1);
19189  else
19190  high = mid;
19191  }
19192  return low;
19193 }
19194 
19195 static UA_NodeStoreEntry *
19196 instantiateEntry(UA_NodeClass nodeClass) {
19197  size_t size = sizeof(UA_NodeStoreEntry) - sizeof(UA_Node);
19198  switch(nodeClass) {
19199  case UA_NODECLASS_OBJECT:
19200  size += sizeof(UA_ObjectNode);
19201  break;
19202  case UA_NODECLASS_VARIABLE:
19203  size += sizeof(UA_VariableNode);
19204  break;
19205  case UA_NODECLASS_METHOD:
19206  size += sizeof(UA_MethodNode);
19207  break;
19209  size += sizeof(UA_ObjectTypeNode);
19210  break;
19212  size += sizeof(UA_VariableTypeNode);
19213  break;
19215  size += sizeof(UA_ReferenceTypeNode);
19216  break;
19217  case UA_NODECLASS_DATATYPE:
19218  size += sizeof(UA_DataTypeNode);
19219  break;
19220  case UA_NODECLASS_VIEW:
19221  size += sizeof(UA_ViewNode);
19222  break;
19223  default:
19224  return NULL;
19225  }
19226  UA_NodeStoreEntry *entry = UA_calloc(1, size);
19227  if(!entry)
19228  return NULL;
19229  entry->node.nodeClass = nodeClass;
19230  return entry;
19231 }
19232 
19233 static void
19234 deleteEntry(UA_NodeStoreEntry *entry) {
19236  UA_free(entry);
19237 }
19238 
19239 /* returns slot of a valid node or null */
19240 static UA_NodeStoreEntry **
19241 findNode(const UA_NodeStore *ns, const UA_NodeId *nodeid) {
19242  UA_UInt32 h = UA_NodeId_hash(nodeid);
19243  UA_UInt32 size = ns->size;
19244  UA_UInt32 idx = mod(h, size);
19245  UA_UInt32 hash2 = mod2(h, size);
19246 
19247  while(true) {
19248  UA_NodeStoreEntry *e = ns->entries[idx];
19249  if(!e)
19250  return NULL;
19251  if(e > UA_NODESTORE_TOMBSTONE &&
19252  UA_NodeId_equal(&e->node.nodeId, nodeid))
19253  return &ns->entries[idx];
19254  idx += hash2;
19255  if(idx >= size)
19256  idx -= size;
19257  }
19258 
19259  /* NOTREACHED */
19260  return NULL;
19261 }
19262 
19263 /* returns an empty slot or null if the nodeid exists */
19264 static UA_NodeStoreEntry **
19265 findSlot(const UA_NodeStore *ns, const UA_NodeId *nodeid) {
19266  UA_UInt32 h = UA_NodeId_hash(nodeid);
19267  UA_UInt32 size = ns->size;
19268  UA_UInt32 idx = mod(h, size);
19269  UA_UInt32 hash2 = mod2(h, size);
19270 
19271  while(true) {
19272  UA_NodeStoreEntry *e = ns->entries[idx];
19273  if(e > UA_NODESTORE_TOMBSTONE &&
19274  UA_NodeId_equal(&e->node.nodeId, nodeid))
19275  return NULL;
19276  if(ns->entries[idx] <= UA_NODESTORE_TOMBSTONE)
19277  return &ns->entries[idx];
19278  idx += hash2;
19279  if(idx >= size)
19280  idx -= size;
19281  }
19282 
19283  /* NOTREACHED */
19284  return NULL;
19285 }
19286 
19287 /* The occupancy of the table after the call will be about 50% */
19288 static UA_StatusCode
19289 expand(UA_NodeStore *ns) {
19290  UA_UInt32 osize = ns->size;
19291  UA_UInt32 count = ns->count;
19292  /* Resize only when table after removal of unused elements is either too
19293  full or too empty */
19294  if(count * 2 < osize && (count * 8 > osize || osize <= UA_NODESTORE_MINSIZE))
19295  return UA_STATUSCODE_GOOD;
19296 
19297  UA_NodeStoreEntry **oentries = ns->entries;
19298  UA_UInt32 nindex = higher_prime_index(count * 2);
19299  UA_UInt32 nsize = primes[nindex];
19300  UA_NodeStoreEntry **nentries = UA_calloc(nsize, sizeof(UA_NodeStoreEntry*));
19301  if(!nentries)
19303 
19304  ns->entries = nentries;
19305  ns->size = nsize;
19306  ns->sizePrimeIndex = nindex;
19307 
19308  /* recompute the position of every entry and insert the pointer */
19309  for(size_t i = 0, j = 0; i < osize && j < count; ++i) {
19310  if(oentries[i] <= UA_NODESTORE_TOMBSTONE)
19311  continue;
19312  UA_NodeStoreEntry **e = findSlot(ns, &oentries[i]->node.nodeId);
19313  UA_assert(e);
19314  *e = oentries[i];
19315  ++j;
19316  }
19317 
19318  UA_free(oentries);
19319  return UA_STATUSCODE_GOOD;
19320 }
19321 
19322 /**********************/
19323 /* Exported functions */
19324 /**********************/
19325 
19326 UA_NodeStore *
19328  UA_NodeStore *ns = UA_malloc(sizeof(UA_NodeStore));
19329  if(!ns)
19330  return NULL;
19331  ns->sizePrimeIndex = higher_prime_index(UA_NODESTORE_MINSIZE);
19332  ns->size = primes[ns->sizePrimeIndex];
19333  ns->count = 0;
19334  ns->entries = UA_calloc(ns->size, sizeof(UA_NodeStoreEntry*));
19335  if(!ns->entries) {
19336  UA_free(ns);
19337  return NULL;
19338  }
19339  return ns;
19340 }
19341 
19342 void
19344  UA_UInt32 size = ns->size;
19345  UA_NodeStoreEntry **entries = ns->entries;
19346  for(UA_UInt32 i = 0; i < size; ++i) {
19347  if(entries[i] > UA_NODESTORE_TOMBSTONE)
19348  deleteEntry(entries[i]);
19349  }
19350  UA_free(ns->entries);
19351  UA_free(ns);
19352 }
19353 
19354 UA_Node *
19356  UA_NodeStoreEntry *entry = instantiateEntry(nodeClass);
19357  if(!entry)
19358  return NULL;
19359  return &entry->node;
19360 }
19361 
19362 void
19363 UA_NodeStore_deleteNode(UA_Node *node) {
19364  UA_NodeStoreEntry *entry = container_of(node, UA_NodeStoreEntry, node);
19365  UA_assert(&entry->node == node);
19366  deleteEntry(entry);
19367 }
19368 
19370 UA_NodeStore_insert(UA_NodeStore *ns, UA_Node *node) {
19371  if(ns->size * 3 <= ns->count * 4) {
19372  if(expand(ns) != UA_STATUSCODE_GOOD)
19374  }
19375 
19376  UA_NodeId tempNodeid;
19377  tempNodeid = node->nodeId;
19378  tempNodeid.namespaceIndex = 0;
19379  UA_NodeStoreEntry **entry;
19380  if(UA_NodeId_isNull(&tempNodeid)) {
19381  /* create a random nodeid */
19382  if(node->nodeId.namespaceIndex == 0)
19383  node->nodeId.namespaceIndex = 1;
19384  UA_UInt32 identifier = ns->count+1; // start value
19385  UA_UInt32 size = ns->size;
19386  UA_UInt32 increase = mod2(identifier, size);
19387  while(true) {
19388  node->nodeId.identifier.numeric = identifier;
19389  entry = findSlot(ns, &node->nodeId);
19390  if(entry)
19391  break;
19392  identifier += increase;
19393  if(identifier >= size)
19394  identifier -= size;
19395  }
19396  } else {
19397  entry = findSlot(ns, &node->nodeId);
19398  if(!entry) {
19401  }
19402  }
19403 
19404  *entry = container_of(node, UA_NodeStoreEntry, node);
19405  ++ns->count;
19406  UA_assert(&(*entry)->node == node);
19407  return UA_STATUSCODE_GOOD;
19408 }
19409 
19411 UA_NodeStore_replace(UA_NodeStore *ns, UA_Node *node) {
19412  UA_NodeStoreEntry **entry = findNode(ns, &node->nodeId);
19413  if(!entry)
19415  UA_NodeStoreEntry *newEntry = container_of(node, UA_NodeStoreEntry, node);
19416  if(*entry != newEntry->orig) {
19417  // the node was replaced since the copy was made
19418  deleteEntry(newEntry);
19420  }
19421  deleteEntry(*entry);
19422  *entry = newEntry;
19423  return UA_STATUSCODE_GOOD;
19424 }
19425 
19426 const UA_Node *
19428  UA_NodeStoreEntry **entry = findNode(ns, nodeid);
19429  if(!entry)
19430  return NULL;
19431  return (const UA_Node*)&(*entry)->node;
19432 }
19433 
19434 UA_Node *
19436  UA_NodeStoreEntry **slot = findNode(ns, nodeid);
19437  if(!slot)
19438  return NULL;
19439  UA_NodeStoreEntry *entry = *slot;
19440  UA_NodeStoreEntry *new = instantiateEntry(entry->node.nodeClass);
19441  if(!new)
19442  return NULL;
19443  if(UA_Node_copyAnyNodeClass(&entry->node, &new->node) != UA_STATUSCODE_GOOD) {
19444  deleteEntry(new);
19445  return NULL;
19446  }
19447  new->orig = entry; // store the pointer to the original
19448  return &new->node;
19449 }
19450 
19453  UA_NodeStoreEntry **slot = findNode(ns, nodeid);
19454  if(!slot)
19456  deleteEntry(*slot);
19457  *slot = UA_NODESTORE_TOMBSTONE;
19458  --ns->count;
19459  /* Downsize the hashmap if it is very empty */
19460  if(ns->count * 8 < ns->size && ns->size > 32)
19461  expand(ns); // this can fail. we just continue with the bigger hashmap.
19462  return UA_STATUSCODE_GOOD;
19463 }
19464 
19465 void
19467  for(UA_UInt32 i = 0; i < ns->size; ++i) {
19468  if(ns->entries[i] > UA_NODESTORE_TOMBSTONE)
19469  visitor((UA_Node*)&ns->entries[i]->node);
19470  }
19471 }
19472 
19473 #endif /* UA_ENABLE_MULTITHREADING */
19474 
19475 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_nodestore_concurrent.c" ***********************************/
19476 
19477 /* This Source Code Form is subject to the terms of the Mozilla Public
19478 * License, v. 2.0. If a copy of the MPL was not distributed with this
19479 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
19480 
19481 
19482 #ifdef UA_ENABLE_MULTITHREADING /* conditional compilation */
19483 #include <urcu/rculfhash.h>
19484 
19485 struct nodeEntry {
19486  struct cds_lfht_node htn;
19487  struct rcu_head rcu_head;
19488  struct nodeEntry *orig; //< the version this is a copy from (or NULL)
19489  UA_Node node;
19490 };
19491 
19492 static struct nodeEntry * instantiateEntry(UA_NodeClass class) {
19493  size_t size = sizeof(struct nodeEntry) - sizeof(UA_Node);
19494  switch(class) {
19495  case UA_NODECLASS_OBJECT:
19496  size += sizeof(UA_ObjectNode);
19497  break;
19498  case UA_NODECLASS_VARIABLE:
19499  size += sizeof(UA_VariableNode);
19500  break;
19501  case UA_NODECLASS_METHOD:
19502  size += sizeof(UA_MethodNode);
19503  break;
19505  size += sizeof(UA_ObjectTypeNode);
19506  break;
19508  size += sizeof(UA_VariableTypeNode);
19509  break;
19511  size += sizeof(UA_ReferenceTypeNode);
19512  break;
19513  case UA_NODECLASS_DATATYPE:
19514  size += sizeof(UA_DataTypeNode);
19515  break;
19516  case UA_NODECLASS_VIEW:
19517  size += sizeof(UA_ViewNode);
19518  break;
19519  default:
19520  return NULL;
19521  }
19522  struct nodeEntry *entry = UA_calloc(1, size);
19523  if(!entry)
19524  return NULL;
19525  entry->node.nodeClass = class;
19526  return entry;
19527 }
19528 
19529 static void deleteEntry(struct rcu_head *head) {
19530  struct nodeEntry *entry = container_of(head, struct nodeEntry, rcu_head);
19531  UA_Node_deleteMembersAnyNodeClass(&entry->node);
19532  UA_free(entry);
19533 }
19534 
19535 /* We are in a rcu_read lock. So the node will not be freed under our feet. */
19536 static int compare(struct cds_lfht_node *htn, const void *orig) {
19537  const UA_NodeId *origid = (const UA_NodeId *)orig;
19538  /* The htn is first in the entry structure. */
19539  const UA_NodeId *newid = &((struct nodeEntry *)htn)->node.nodeId;
19540  return UA_NodeId_equal(newid, origid);
19541 }
19542 
19544  /* 64 is the minimum size for the hashtable. */
19545  return (UA_NodeStore*)cds_lfht_new(64, 64, 0, CDS_LFHT_AUTO_RESIZE, NULL);
19546 }
19547 
19548 /* do not call with read-side critical section held!! */
19551  struct cds_lfht *ht = (struct cds_lfht*)ns;
19552  struct cds_lfht_iter iter;
19553  cds_lfht_first(ht, &iter);
19554  while(iter.node) {
19555  if(!cds_lfht_del(ht, iter.node)) {
19556  /* points to the htn entry, which is first */
19557  struct nodeEntry *entry = (struct nodeEntry*) iter.node;
19558  call_rcu(&entry->rcu_head, deleteEntry);
19559  }
19560  cds_lfht_next(ht, &iter);
19561  }
19562  UA_RCU_UNLOCK();
19563  cds_lfht_destroy(ht, NULL);
19564  UA_RCU_LOCK();
19565 }
19566 
19567 UA_Node * UA_NodeStore_newNode(UA_NodeClass class) {
19568  struct nodeEntry *entry = instantiateEntry(class);
19569  if(!entry)
19570  return NULL;
19571  return (UA_Node*)&entry->node;
19572 }
19573 
19574 void UA_NodeStore_deleteNode(UA_Node *node) {
19575  struct nodeEntry *entry = container_of(node, struct nodeEntry, node);
19576  deleteEntry(&entry->rcu_head);
19577 }
19578 
19579 UA_StatusCode UA_NodeStore_insert(UA_NodeStore *ns, UA_Node *node) {
19581  struct nodeEntry *entry = container_of(node, struct nodeEntry, node);
19582  struct cds_lfht *ht = (struct cds_lfht*)ns;
19583  cds_lfht_node_init(&entry->htn);
19584  struct cds_lfht_node *result;
19585  //namespace index is assumed to be valid
19586  UA_NodeId tempNodeid;
19587  tempNodeid = node->nodeId;
19588  tempNodeid.namespaceIndex = 0;
19589  if(!UA_NodeId_isNull(&tempNodeid)) {
19590  UA_UInt32 h = UA_NodeId_hash(&node->nodeId);
19591  result = cds_lfht_add_unique(ht, h, compare, &node->nodeId, &entry->htn);
19592  /* If the nodeid exists already */
19593  if(result != &entry->htn) {
19594  deleteEntry(&entry->rcu_head);
19596  }
19597  } else {
19598  /* create a unique nodeid */
19599  node->nodeId.identifierType = UA_NODEIDTYPE_NUMERIC;
19600  if(node->nodeId.namespaceIndex == 0) // original request for ns=0 should yield ns=1
19601  node->nodeId.namespaceIndex = 1;
19602 
19603  unsigned long identifier;
19604  long before, after;
19605  cds_lfht_count_nodes(ht, &before, &identifier, &after); // current number of nodes stored
19606  ++identifier;
19607 
19608  node->nodeId.identifier.numeric = (UA_UInt32)identifier;
19609  while(true) {
19610  UA_UInt32 h = UA_NodeId_hash(&node->nodeId);
19611  result = cds_lfht_add_unique(ht, h, compare, &node->nodeId, &entry->htn);
19612  if(result == &entry->htn)
19613  break;
19614  node->nodeId.identifier.numeric += (UA_UInt32)(identifier * 2654435761);
19615  }
19616  }
19617  return UA_STATUSCODE_GOOD;
19618 }
19619 
19620 UA_StatusCode UA_NodeStore_replace(UA_NodeStore *ns, UA_Node *node) {
19622  struct nodeEntry *entry = container_of(node, struct nodeEntry, node);
19623  struct cds_lfht *ht = (struct cds_lfht*)ns;
19624 
19625  /* Get the current version */
19626  UA_UInt32 h = UA_NodeId_hash(&node->nodeId);
19627  struct cds_lfht_iter iter;
19628  cds_lfht_lookup(ht, h, compare, &node->nodeId, &iter);
19629  if(!iter.node)
19631 
19632  /* We try to replace an obsolete version of the node */
19633  struct nodeEntry *oldEntry = (struct nodeEntry*)iter.node;
19634  if(oldEntry != entry->orig) {
19635  deleteEntry(&entry->rcu_head);
19637  }
19638 
19639  cds_lfht_node_init(&entry->htn);
19640  if(cds_lfht_replace(ht, &iter, h, compare, &node->nodeId, &entry->htn) != 0) {
19641  /* Replacing failed. Maybe the node got replaced just before this thread tried to.*/
19642  deleteEntry(&entry->rcu_head);
19644  }
19645 
19646  /* If an entry got replaced, mark it as dead. */
19647  call_rcu(&oldEntry->rcu_head, deleteEntry);
19648  return UA_STATUSCODE_GOOD;
19649 }
19650 
19653  struct cds_lfht *ht = (struct cds_lfht*)ns;
19654  UA_UInt32 h = UA_NodeId_hash(nodeid);
19655  struct cds_lfht_iter iter;
19656  cds_lfht_lookup(ht, h, compare, nodeid, &iter);
19657  if(!iter.node || cds_lfht_del(ht, iter.node) != 0)
19659  struct nodeEntry *entry = (struct nodeEntry*)iter.node;
19660  call_rcu(&entry->rcu_head, deleteEntry);
19661  return UA_STATUSCODE_GOOD;
19662 }
19663 
19664 const UA_Node * UA_NodeStore_get(UA_NodeStore *ns, const UA_NodeId *nodeid) {
19666  struct cds_lfht *ht = (struct cds_lfht*)ns;
19667  UA_UInt32 h = UA_NodeId_hash(nodeid);
19668  struct cds_lfht_iter iter;
19669  cds_lfht_lookup(ht, h, compare, nodeid, &iter);
19670  struct nodeEntry *found_entry = (struct nodeEntry*)iter.node;
19671  if(!found_entry)
19672  return NULL;
19673  return &found_entry->node;
19674 }
19675 
19676 UA_Node * UA_NodeStore_getCopy(UA_NodeStore *ns, const UA_NodeId *nodeid) {
19678  struct cds_lfht *ht = (struct cds_lfht*)ns;
19679  UA_UInt32 h = UA_NodeId_hash(nodeid);
19680  struct cds_lfht_iter iter;
19681  cds_lfht_lookup(ht, h, compare, nodeid, &iter);
19682  struct nodeEntry *entry = (struct nodeEntry*)iter.node;
19683  if(!entry)
19684  return NULL;
19685  struct nodeEntry *new = instantiateEntry(entry->node.nodeClass);
19686  if(!new)
19687  return NULL;
19688  if(UA_Node_copyAnyNodeClass(&entry->node, &new->node) != UA_STATUSCODE_GOOD) {
19689  deleteEntry(&new->rcu_head);
19690  return NULL;
19691  }
19692  new->orig = entry;
19693  return &new->node;
19694 }
19695 
19698  struct cds_lfht *ht = (struct cds_lfht*)ns;
19699  struct cds_lfht_iter iter;
19700  cds_lfht_first(ht, &iter);
19701  while(iter.node != NULL) {
19702  struct nodeEntry *found_entry = (struct nodeEntry*)iter.node;
19703  visitor(&found_entry->node);
19704  cds_lfht_next(ht, &iter);
19705  }
19706 }
19707 
19708 #endif /* UA_ENABLE_MULTITHREADING */
19709 
19710 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_discovery.c" ***********************************/
19711 
19712 /* This Source Code Form is subject to the terms of the Mozilla Public
19713 * License, v. 2.0. If a copy of the MPL was not distributed with this
19714 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
19715 
19716 
19717 void Service_FindServers(UA_Server *server, UA_Session *session,
19718  const UA_FindServersRequest *request, UA_FindServersResponse *response) {
19719  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing FindServersRequest");
19720  /* copy ApplicationDescription from the config */
19722  if(!descr) {
19724  return;
19725  }
19726  response->responseHeader.serviceResult =
19727  UA_ApplicationDescription_copy(&server->config.applicationDescription, descr);
19729  UA_free(descr);
19730  return;
19731  }
19732 
19733  /* add the discoveryUrls from the networklayers */
19734  UA_String *disc = UA_realloc(descr->discoveryUrls, sizeof(UA_String) *
19735  (descr->discoveryUrlsSize + server->config.networkLayersSize));
19736  if(!disc) {
19738  UA_ApplicationDescription_delete(descr);
19739  return;
19740  }
19741  size_t existing = descr->discoveryUrlsSize;
19742  descr->discoveryUrls = disc;
19743  descr->discoveryUrlsSize += server->config.networkLayersSize;
19744 
19745  // TODO: Add nl only if discoveryUrl not already present
19746  for(size_t i = 0; i < server->config.networkLayersSize; ++i) {
19747  UA_ServerNetworkLayer *nl = &server->config.networkLayers[i];
19748  UA_String_copy(&nl->discoveryUrl, &descr->discoveryUrls[existing + i]);
19749  }
19750 
19751  response->servers = descr;
19752  response->serversSize = 1;
19753 }
19754 
19755 void Service_GetEndpoints(UA_Server *server, UA_Session *session, const UA_GetEndpointsRequest *request,
19756  UA_GetEndpointsResponse *response) {
19757  /* If the client expects to see a specific endpointurl, mirror it back. If
19758  not, clone the endpoints with the discovery url of all networklayers. */
19759  const UA_String *endpointUrl = &request->endpointUrl;
19760  if(endpointUrl->length > 0) {
19761  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing GetEndpointsRequest with endpointUrl " \
19763  } else {
19764  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing GetEndpointsRequest with an empty endpointUrl");
19765  }
19766 
19767  /* test if the supported binary profile shall be returned */
19768 #ifdef NO_ALLOCA
19769  UA_Boolean relevant_endpoints[server->endpointDescriptionsSize];
19770 #else
19771  UA_Boolean *relevant_endpoints = UA_alloca(sizeof(UA_Boolean) * server->endpointDescriptionsSize);
19772 #endif
19773  memset(relevant_endpoints, 0, sizeof(UA_Boolean) * server->endpointDescriptionsSize);
19774  size_t relevant_count = 0;
19775  if(request->profileUrisSize == 0) {
19776  for(size_t j = 0; j < server->endpointDescriptionsSize; ++j)
19777  relevant_endpoints[j] = true;
19778  relevant_count = server->endpointDescriptionsSize;
19779  } else {
19780  for(size_t j = 0; j < server->endpointDescriptionsSize; ++j) {
19781  for(size_t i = 0; i < request->profileUrisSize; ++i) {
19783  continue;
19784  relevant_endpoints[j] = true;
19785  ++relevant_count;
19786  break;
19787  }
19788  }
19789  }
19790 
19791  if(relevant_count == 0) {
19792  response->endpointsSize = 0;
19793  return;
19794  }
19795 
19796  /* Clone the endpoint for each networklayer? */
19797  size_t clone_times = 1;
19798  UA_Boolean nl_endpointurl = false;
19799  if(endpointUrl->length == 0) {
19800  clone_times = server->config.networkLayersSize;
19801  nl_endpointurl = true;
19802  }
19803 
19804  response->endpoints = UA_Array_new(relevant_count * clone_times, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
19805  if(!response->endpoints) {
19807  return;
19808  }
19809  response->endpointsSize = relevant_count * clone_times;
19810 
19811  size_t k = 0;
19813  for(size_t i = 0; i < clone_times; ++i) {
19814  if(nl_endpointurl)
19815  endpointUrl = &server->config.networkLayers[i].discoveryUrl;
19816  for(size_t j = 0; j < server->endpointDescriptionsSize; ++j) {
19817  if(!relevant_endpoints[j])
19818  continue;
19819  retval |= UA_EndpointDescription_copy(&server->endpointDescriptions[j], &response->endpoints[k]);
19820  retval |= UA_String_copy(endpointUrl, &response->endpoints[k].endpointUrl);
19821  ++k;
19822  }
19823  }
19824 
19825  if(retval != UA_STATUSCODE_GOOD) {
19826  response->responseHeader.serviceResult = retval;
19827  UA_Array_delete(response->endpoints, response->endpointsSize, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
19828  response->endpoints = NULL;
19829  response->endpointsSize = 0;
19830  return;
19831  }
19832 }
19833 
19834 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_securechannel.c" ***********************************/
19835 
19836 /* This Source Code Form is subject to the terms of the Mozilla Public
19837 * License, v. 2.0. If a copy of the MPL was not distributed with this
19838 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
19839 
19840 
19841 void Service_OpenSecureChannel(UA_Server *server, UA_Connection *connection,
19842  const UA_OpenSecureChannelRequest *request,
19843  UA_OpenSecureChannelResponse *response) {
19844  // todo: if(request->clientProtocolVersion != protocolVersion)
19846  response->responseHeader.serviceResult =
19847  UA_SecureChannelManager_open(&server->secureChannelManager, connection, request, response);
19848 
19850  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
19851  "Connection %i | SecureChannel %i | OpenSecureChannel: Opened SecureChannel",
19852  connection->sockfd, response->securityToken.channelId);
19853  } else {
19854  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
19855  "Connection %i | OpenSecureChannel: Opening a SecureChannel failed",
19856  connection->sockfd);
19857  }
19858  } else {
19859  response->responseHeader.serviceResult =
19860  UA_SecureChannelManager_renew(&server->secureChannelManager, connection, request, response);
19861 
19863  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
19864  "Connection %i | SecureChannel %i | OpenSecureChannel: SecureChannel renewed",
19865  connection->sockfd, response->securityToken.channelId);
19866  } else {
19867  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
19868  "Connection %i | OpenSecureChannel: Renewing SecureChannel failed",
19869  connection->sockfd);
19870  }
19871  }
19872 }
19873 
19874 /* The server does not send a CloseSecureChannel response */
19875 void Service_CloseSecureChannel(UA_Server *server, UA_SecureChannel *channel) {
19876  UA_LOG_INFO_CHANNEL(server->config.logger, channel, "CloseSecureChannel");
19878 }
19879 
19880 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_session.c" ***********************************/
19881 
19882 /* This Source Code Form is subject to the terms of the Mozilla Public
19883 * License, v. 2.0. If a copy of the MPL was not distributed with this
19884 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
19885 
19886 
19887 void Service_CreateSession(UA_Server *server, UA_SecureChannel *channel,
19888  const UA_CreateSessionRequest *request,
19889  UA_CreateSessionResponse *response) {
19890  if(channel->securityToken.channelId == 0) {
19892  return;
19893  }
19894 
19895  /* Copy the server's endpoint into the response */
19896  response->responseHeader.serviceResult =
19898  (void**)&response->serverEndpoints, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
19900  return;
19901  response->serverEndpointsSize = server->endpointDescriptionsSize;
19902 
19903  /* Mirror back the endpointUrl */
19904  for(size_t i = 0; i < response->serverEndpointsSize; ++i)
19905  UA_String_copy(&request->endpointUrl, &response->serverEndpoints[i].endpointUrl);
19906 
19907  UA_Session *newSession;
19908  response->responseHeader.serviceResult =
19909  UA_SessionManager_createSession(&server->sessionManager, channel, request, &newSession);
19911  UA_LOG_DEBUG_CHANNEL(server->config.logger, channel, "Processing CreateSessionRequest failed");
19912  return;
19913  }
19914 
19915  newSession->maxResponseMessageSize = request->maxResponseMessageSize;
19916  newSession->maxRequestMessageSize = channel->connection->localConf.maxMessageSize;
19917  response->sessionId = newSession->sessionId;
19918  response->revisedSessionTimeout = (UA_Double)newSession->timeout;
19919  response->authenticationToken = newSession->authenticationToken;
19920  response->responseHeader.serviceResult = UA_String_copy(&request->sessionName, &newSession->sessionName);
19921  if(server->endpointDescriptionsSize > 0)
19922  response->responseHeader.serviceResult |=
19923  UA_ByteString_copy(&server->endpointDescriptions->serverCertificate,
19924  &response->serverCertificate);
19927  return;
19928  }
19929  UA_LOG_DEBUG_CHANNEL(server->config.logger, channel, "Session " UA_PRINTF_GUID_FORMAT " created",
19931 }
19932 
19933 void
19934 Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel,
19935  UA_Session *session, const UA_ActivateSessionRequest *request,
19936  UA_ActivateSessionResponse *response) {
19937  if(session->validTill < UA_DateTime_nowMonotonic()) {
19938  UA_LOG_INFO_SESSION(server->config.logger, session, "ActivateSession: SecureChannel %i wants "
19939  "to activate, but the session has timed out", channel->securityToken.channelId);
19941  return;
19942  }
19943 
19947  UA_LOG_INFO_SESSION(server->config.logger, session, "ActivateSession: SecureChannel %i wants "
19948  "to activate, but the UserIdentify token is invalid", channel->securityToken.channelId);
19950  return;
19951  }
19952 
19953 
19954  UA_String ap = UA_STRING(ANONYMOUS_POLICY);
19955  UA_String up = UA_STRING(USERNAME_POLICY);
19956 
19957  /* Compatibility notice: Siemens OPC Scout v10 provides an empty policyId,
19958  this is not okay For compatibility we will assume that empty policyId == ANONYMOUS_POLICY
19959  if(token.policyId->data == NULL)
19960  response->responseHeader.serviceResult = UA_STATUSCODE_BADIDENTITYTOKENINVALID;
19961  */
19962 
19963  if(server->config.enableAnonymousLogin &&
19965  /* anonymous login */
19966  const UA_AnonymousIdentityToken *token = request->userIdentityToken.content.decoded.data;
19967  if(token->policyId.data && !UA_String_equal(&token->policyId, &ap)) {
19969  return;
19970  }
19971  } else if(server->config.enableUsernamePasswordLogin &&
19972  request->userIdentityToken.content.decoded.type == &UA_TYPES[UA_TYPES_USERNAMEIDENTITYTOKEN]) {
19973  /* username login */
19974  const UA_UserNameIdentityToken *token = request->userIdentityToken.content.decoded.data;
19975  if(!UA_String_equal(&token->policyId, &up)) {
19977  return;
19978  }
19979  if(token->encryptionAlgorithm.length > 0) {
19980  /* we don't support encryption */
19982  return;
19983  }
19984 
19985  if(token->userName.length == 0 && token->password.length == 0) {
19986  /* empty username and password */
19988  return;
19989  }
19990 
19991  /* trying to match pw/username */
19992  UA_Boolean match = false;
19993  for(size_t i = 0; i < server->config.usernamePasswordLoginsSize; ++i) {
19994  UA_String *user = &server->config.usernamePasswordLogins[i].username;
19995  UA_String *pw = &server->config.usernamePasswordLogins[i].password;
19996  if(UA_String_equal(&token->userName, user) && UA_String_equal(&token->password, pw)) {
19997  match = true;
19998  break;
19999  }
20000  }
20001  if(!match) {
20002  UA_LOG_INFO_SESSION(server->config.logger, session,
20003  "ActivateSession: Did not find matching username/password");
20005  return;
20006  }
20007  } else {
20008  /* Unsupported token type */
20010  return;
20011  }
20012 
20013  /* Detach the old SecureChannel */
20014  if(session->channel && session->channel != channel) {
20015  UA_LOG_INFO_SESSION(server->config.logger, session, "ActivateSession: Detach from old channel");
20016  UA_SecureChannel_detachSession(session->channel, session);
20017  }
20018 
20019  /* Attach to the SecureChannel and activate */
20020  UA_SecureChannel_attachSession(channel, session);
20021  session->activated = true;
20022  UA_Session_updateLifetime(session);
20023  UA_LOG_INFO_SESSION(server->config.logger, session, "ActivateSession: Session activated");
20024 }
20025 
20026 void
20027 Service_CloseSession(UA_Server *server, UA_Session *session, const UA_CloseSessionRequest *request,
20028  UA_CloseSessionResponse *response) {
20029  UA_LOG_INFO_SESSION(server->config.logger, session, "CloseSession");
20030  response->responseHeader.serviceResult =
20032 }
20033 
20034 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_attribute.c" ***********************************/
20035 
20036 /* This Source Code Form is subject to the terms of the Mozilla Public
20037 * License, v. 2.0. If a copy of the MPL was not distributed with this
20038 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
20039 
20040 #ifdef UA_ENABLE_NONSTANDARD_STATELESS
20041 #endif
20042 
20043 /* Force cast from const data for zero-copy reading. The storage type is set to
20044  nodelete. So the value is not deleted. Use with care! */
20045 static void
20046 forceVariantSetScalar(UA_Variant *v, const void *p, const UA_DataType *t) {
20047  UA_Variant_init(v);
20048  v->type = t;
20049  v->data = (void*)(uintptr_t)p;
20051 }
20052 
20053 /*****************/
20054 /* Type Checking */
20055 /*****************/
20056 
20061 };
20062 
20063 static enum type_equivalence
20064 typeEquivalence(const UA_DataType *t) {
20065  if(t->membersSize != 1 || !t->members[0].namespaceZero)
20066  return TYPE_EQUIVALENCE_NONE;
20068  return TYPE_EQUIVALENCE_ENUM;
20069  if(t->members[0].memberTypeIndex == UA_TYPES_BYTE && t->members[0].isArray)
20070  return TYPE_EQUIVALENCE_OPAQUE;
20071  return TYPE_EQUIVALENCE_NONE;
20072 }
20073 
20074 /* Test whether a valurank and the given arraydimensions are compatible. zero
20075  * array dimensions indicate a scalar */
20076 static UA_StatusCode
20077 compatibleValueRankArrayDimensions(UA_Int32 valueRank, size_t arrayDimensionsSize) {
20078  switch(valueRank) {
20079  case -3: /* the value can be a scalar or a one dimensional array */
20080  if(arrayDimensionsSize > 1)
20082  break;
20083  case -2: /* the value can be a scalar or an array with any number of dimensions */
20084  break;
20085  case -1: /* the value is a scalar */
20086  if(arrayDimensionsSize > 0)
20088  break;
20089  case 0: /* the value is an array with one or more dimensions */
20090  if(arrayDimensionsSize < 1)
20092  break;
20093  default: /* >= 1: the value is an array with the specified number of dimensions */
20094  if(valueRank < 0)
20096  /* Must hold if the array has a defined length. Null arrays (length -1)
20097  * need to be caught before. */
20098  if(arrayDimensionsSize != (size_t)valueRank)
20100  }
20101  return UA_STATUSCODE_GOOD;
20102 }
20103 
20104 /* Check if the valuerank allows for the value dimension */
20105 static UA_StatusCode
20106 compatibleValueRankValue(UA_Int32 valueRank, const UA_Variant *value) {
20107  /* empty arrays (-1) always match */
20108  if(value->data == NULL)
20109  return UA_STATUSCODE_GOOD;
20110 
20111  size_t arrayDims = value->arrayDimensionsSize;
20112  if(!UA_Variant_isScalar(value))
20113  arrayDims = 1; /* array but no arraydimensions -> implicit array dimension 1 */
20114  return compatibleValueRankArrayDimensions(valueRank, arrayDims);
20115 }
20116 
20118 compatibleArrayDimensions(size_t constraintArrayDimensionsSize,
20119  const UA_UInt32 *constraintArrayDimensions,
20120  size_t testArrayDimensionsSize,
20121  const UA_UInt32 *testArrayDimensions) {
20122  /* No array dimensions defined -> everything is permitted if the value rank fits */
20123  if(constraintArrayDimensionsSize == 0) {
20124  return UA_STATUSCODE_GOOD;
20125  }
20126 
20127  /* Dimension count must match */
20128  if(testArrayDimensionsSize != constraintArrayDimensionsSize)
20130 
20131  /* Dimension lengths must match; zero in the constraint is a wildcard */
20132  for(size_t i = 0; i < constraintArrayDimensionsSize; ++i) {
20133  if(constraintArrayDimensions[i] != testArrayDimensions[i] &&
20134  constraintArrayDimensions[i] != 0)
20136  }
20137  return UA_STATUSCODE_GOOD;
20138 }
20139 
20140 /* Returns the pointer to a datavalue with a possibly transformed type to match
20141  the description */
20142 static const UA_Variant *
20143 convertToMatchingValue(UA_Server *server, const UA_Variant *value,
20144  const UA_NodeId *targetDataTypeId, UA_Variant *editableValue) {
20145  const UA_DataType *targetDataType = UA_findDataType(targetDataTypeId);
20146  if(!targetDataType)
20147  return NULL;
20148 
20149  /* A string is written to a byte array. the valuerank and array
20150  dimensions are checked later */
20151  if(targetDataType == &UA_TYPES[UA_TYPES_BYTE] &&
20152  value->type == &UA_TYPES[UA_TYPES_BYTESTRING] &&
20153  UA_Variant_isScalar(value)) {
20154  UA_ByteString *str = (UA_ByteString*)value->data;
20155  editableValue->storageType = UA_VARIANT_DATA_NODELETE;
20156  editableValue->type = &UA_TYPES[UA_TYPES_BYTE];
20157  editableValue->arrayLength = str->length;
20158  editableValue->data = str->data;
20159  return editableValue;
20160  }
20161 
20162  /* An enum was sent as an int32, or an opaque type as a bytestring. This
20163  * is detected with the typeIndex indicating the "true" datatype. */
20164  enum type_equivalence te1 = typeEquivalence(targetDataType);
20165  enum type_equivalence te2 = typeEquivalence(value->type);
20166  if(te1 != TYPE_EQUIVALENCE_NONE && te1 == te2) {
20167  *editableValue = *value;
20168  editableValue->storageType = UA_VARIANT_DATA_NODELETE;
20169  editableValue->type = targetDataType;
20170  return editableValue;
20171  }
20172 
20173  /* No more possible equivalencies */
20174  return NULL;
20175 }
20176 
20177 /* Test whether the value matches a variable definition given by
20178  * - datatype
20179  * - valueranke
20180  * - array dimensions.
20181  * Sometimes it can be necessary to transform the content of the value, e.g.
20182  * byte array to bytestring or uint32 to some enum. If editableValue is non-NULL,
20183  * we try to create a matching variant that points to the original data. */
20185 typeCheckValue(UA_Server *server, const UA_NodeId *targetDataTypeId,
20186  UA_Int32 targetValueRank, size_t targetArrayDimensionsSize,
20187  const UA_UInt32 *targetArrayDimensions, const UA_Variant *value,
20188  const UA_NumericRange *range, UA_Variant *editableValue) {
20189  /* Empty variant is only allowed for BaseDataType */
20190  if(!value->type)
20191  goto check_array;
20192 
20193  /* See if the types match. The nodeid on the wire may be != the nodeid in
20194  * the node for opaque types, enums and bytestrings. value contains the
20195  * correct type definition after the following paragraph */
20196  if(UA_NodeId_equal(&value->type->typeId, targetDataTypeId))
20197  goto check_array;
20198 
20199  /* Has the value a subtype of the required type? */
20200  const UA_NodeId subtypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
20201  if(isNodeInTree(server->nodestore, &value->type->typeId, targetDataTypeId, &subtypeId, 1))
20202  goto check_array;
20203 
20204  /* Try to convert to a matching value if this is wanted */
20205  if(!editableValue)
20207  value = convertToMatchingValue(server, value, targetDataTypeId, editableValue);
20208  if(!value)
20210 
20211  check_array:
20212  if(range) /* array dimensions are checked later when writing the range */
20213  return UA_STATUSCODE_GOOD;
20214 
20215  size_t valueArrayDimensionsSize = value->arrayDimensionsSize;
20216  UA_UInt32 *valueArrayDimensions = value->arrayDimensions;
20217  UA_UInt32 tempArrayDimensions;
20218  if(valueArrayDimensions == 0 && !UA_Variant_isScalar(value)) {
20219  valueArrayDimensionsSize = 1;
20220  tempArrayDimensions = (UA_UInt32)value->arrayLength;
20221  valueArrayDimensions = &tempArrayDimensions;
20222  }
20223 
20224  /* See if the array dimensions match. When arrayDimensions are defined, they
20225  * already hold the valuerank. */
20226  if(targetArrayDimensionsSize > 0)
20227  return compatibleArrayDimensions(targetArrayDimensionsSize, targetArrayDimensions,
20228  valueArrayDimensionsSize, valueArrayDimensions);
20229 
20230  /* Check if the valuerank allows for the value dimension */
20231  return compatibleValueRankValue(targetValueRank, value);
20232 }
20233 
20234 /*****************************/
20235 /* ArrayDimensions Attribute */
20236 /*****************************/
20237 
20238 static UA_StatusCode
20239 readArrayDimensionsAttribute(const UA_VariableNode *vn, UA_DataValue *v) {
20240  UA_Variant_setArray(&v->value, vn->arrayDimensions,
20241  vn->arrayDimensionsSize, &UA_TYPES[UA_TYPES_UINT32]);
20243  v->hasValue = true;
20244  return UA_STATUSCODE_GOOD;
20245 }
20246 
20247 static UA_StatusCode
20248 writeArrayDimensionsAttribute(UA_Server *server, UA_VariableNode *node,
20249  size_t arrayDimensionsSize, UA_UInt32 *arrayDimensions) {
20250  /* If this is a variabletype, there must be no instances or subtypes of it
20251  * when we do the change */
20252  if(node->nodeClass == UA_NODECLASS_VARIABLETYPE &&
20253  UA_Node_hasSubTypeOrInstances((const UA_Node*)node))
20255 
20256  /* Check that the array dimensions match with the valuerank */
20257  UA_StatusCode retval = compatibleValueRankArrayDimensions(node->valueRank, arrayDimensionsSize);
20258  if(retval != UA_STATUSCODE_GOOD) {
20259  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER,
20260  "The current value rank does not match the new array dimensions");
20261  return retval;
20262  }
20263 
20264  /* Get the VariableType */
20265  const UA_VariableTypeNode *vt = getVariableNodeType(server, (UA_VariableNode*)node);
20266  if(!vt)
20268 
20269  /* Check if the array dimensions match with the wildcards in the
20270  * variabletype (dimension length 0) */
20271  if(vt->arrayDimensions) {
20272  retval = compatibleArrayDimensions(vt->arrayDimensionsSize, vt->arrayDimensions,
20273  arrayDimensionsSize, arrayDimensions);
20274  if(retval != UA_STATUSCODE_GOOD) {
20275  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER,
20276  "Array dimensions in the variable type do not match");
20277  return retval;
20278  }
20279  }
20280 
20281  /* Check if the current value is compatible with the array dimensions */
20282  UA_DataValue value;
20283  UA_DataValue_init(&value);
20284  retval = readValueAttribute(server, node, &value);
20285  if(retval != UA_STATUSCODE_GOOD)
20286  return retval;
20287  if(value.hasValue) {
20288  retval = compatibleArrayDimensions(arrayDimensionsSize, arrayDimensions,
20289  value.value.arrayDimensionsSize,
20290  value.value.arrayDimensions);
20291  UA_DataValue_deleteMembers(&value);
20292  if(retval != UA_STATUSCODE_GOOD) {
20293  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER,
20294  "Array dimensions in the current value do not match");
20295  return retval;
20296  }
20297  }
20298 
20299  /* Ok, apply */
20300  UA_UInt32 *oldArrayDimensions = node->arrayDimensions;
20301  retval = UA_Array_copy(arrayDimensions, arrayDimensionsSize,
20302  (void**)&node->arrayDimensions, &UA_TYPES[UA_TYPES_UINT32]);
20303  if(retval != UA_STATUSCODE_GOOD)
20304  return retval;
20305  UA_free(oldArrayDimensions);
20306  node->arrayDimensionsSize = arrayDimensionsSize;
20307  return UA_STATUSCODE_GOOD;
20308 }
20309 
20310 /***********************/
20311 /* ValueRank Attribute */
20312 /***********************/
20313 
20314 static UA_StatusCode
20315 writeValueRankAttributeWithVT(UA_Server *server, UA_VariableNode *node,
20316  UA_Int32 valueRank) {
20317  const UA_VariableTypeNode *vt = getVariableNodeType(server, node);
20318  if(!vt)
20320  return writeValueRankAttribute(server, node, valueRank, vt->valueRank);
20321 }
20322 
20324 writeValueRankAttribute(UA_Server *server, UA_VariableNode *node, UA_Int32 valueRank,
20325  UA_Int32 constraintValueRank) {
20326  /* If this is a variabletype, there must be no instances or subtypes of it
20327  when we do the change */
20328  if(node->nodeClass == UA_NODECLASS_VARIABLETYPE &&
20329  UA_Node_hasSubTypeOrInstances((const UA_Node*)node))
20331 
20332  /* Check if the valuerank of the variabletype allows the change. */
20333  switch(constraintValueRank) {
20334  case -3: /* the value can be a scalar or a one dimensional array */
20335  if(valueRank != -1 && valueRank != 1)
20337  break;
20338  case -2: /* the value can be a scalar or an array with any number of dimensions */
20339  break;
20340  case -1: /* the value is a scalar */
20341  if(valueRank != -1)
20343  break;
20344  case 0: /* the value is an array with one or more dimensions */
20345  if(valueRank < 0)
20347  break;
20348  default: /* >= 1: the value is an array with the specified number of dimensions */
20349  if(valueRank != constraintValueRank)
20351  break;
20352  }
20353 
20354  /* Check if the new valuerank is compatible with the array dimensions. Use
20355  * the read service to handle data sources. */
20356  size_t arrayDims = node->arrayDimensionsSize;
20358  if(arrayDims == 0) {
20359  /* the value could be an array with no arrayDimensions defined.
20360  dimensions zero indicate a scalar for compatibleValueRankArrayDimensions. */
20361  UA_DataValue value;
20362  UA_DataValue_init(&value);
20363  retval = readValueAttribute(server, node, &value);
20364  if(retval != UA_STATUSCODE_GOOD)
20365  return retval;
20366  if(!value.hasValue || value.value.data == NULL)
20367  goto apply; /* no value or null array */
20368  if(!UA_Variant_isScalar(&value.value))
20369  arrayDims = 1;
20370  UA_DataValue_deleteMembers(&value);
20371  }
20372  retval = compatibleValueRankArrayDimensions(valueRank, arrayDims);
20373  if(retval != UA_STATUSCODE_GOOD)
20374  return retval;
20375 
20376  /* All good, apply the change */
20377  apply:
20378  node->valueRank = valueRank;
20379  return UA_STATUSCODE_GOOD;
20380 }
20381 
20382 /**********************/
20383 /* DataType Attribute */
20384 /**********************/
20385 
20386 static UA_StatusCode
20387 writeDataTypeAttributeWithVT(UA_Server *server, UA_VariableNode *node,
20388  const UA_NodeId *dataType) {
20389  const UA_VariableTypeNode *vt = getVariableNodeType(server, node);
20390  if(!vt)
20392  return writeDataTypeAttribute(server, node, dataType, &vt->dataType);
20393 }
20394 
20395 /* constraintDataType can be NULL, then we retrieve the vt */
20397 writeDataTypeAttribute(UA_Server *server, UA_VariableNode *node,
20398  const UA_NodeId *dataType, const UA_NodeId *constraintDataType) {
20399  /* If this is a variabletype, there must be no instances or subtypes of it
20400  when we do the change */
20401  if(node->nodeClass == UA_NODECLASS_VARIABLETYPE &&
20402  UA_Node_hasSubTypeOrInstances((const UA_Node*)node))
20404 
20405  /* Does the new type match the constraints of the variabletype? */
20406  UA_NodeId subtypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
20407  if(!isNodeInTree(server->nodestore, dataType,
20408  constraintDataType, &subtypeId, 1))
20410 
20411  /* Check if the current value would match the new type */
20412  UA_DataValue value;
20413  UA_DataValue_init(&value);
20414  UA_StatusCode retval = readValueAttribute(server, node, &value);
20415  if(retval != UA_STATUSCODE_GOOD)
20416  return retval;
20417  if(value.hasValue) {
20418  retval = typeCheckValue(server, dataType, node->valueRank,
20419  node->arrayDimensionsSize, node->arrayDimensions,
20420  &value.value, NULL, NULL);
20421  UA_DataValue_deleteMembers(&value);
20422  if(retval != UA_STATUSCODE_GOOD) {
20423  UA_LOG_DEBUG(server->config.logger, UA_LOGCATEGORY_SERVER,
20424  "The current value does not match the new data type");
20425  return retval;
20426  }
20427  }
20428 
20429  /* Replace the datatype nodeid */
20430  UA_NodeId dtCopy = node->dataType;
20431  retval = UA_NodeId_copy(dataType, &node->dataType);
20432  if(retval != UA_STATUSCODE_GOOD) {
20433  node->dataType = dtCopy;
20434  return retval;
20435  }
20436  UA_NodeId_deleteMembers(&dtCopy);
20437  return UA_STATUSCODE_GOOD;
20438 }
20439 
20440 /*******************/
20441 /* Value Attribute */
20442 /*******************/
20443 
20444 static UA_StatusCode
20445 readValueAttributeFromNode(UA_Server *server, const UA_VariableNode *vn, UA_DataValue *v,
20446  UA_NumericRange *rangeptr) {
20447  if(vn->value.data.callback.onRead) {
20448  UA_RCU_UNLOCK();
20449  vn->value.data.callback.onRead(vn->value.data.callback.handle,
20450  vn->nodeId, &vn->value.data.value.value, rangeptr);
20451  UA_RCU_LOCK();
20452 #ifdef UA_ENABLE_MULTITHREADING
20453  /* Reopen the node to see the changes (multithreading only) */
20454  vn = (const UA_VariableNode*)UA_NodeStore_get(server->nodestore, &vn->nodeId);
20455 #endif
20456  }
20457  if(rangeptr)
20458  return UA_Variant_copyRange(&vn->value.data.value.value, &v->value, *rangeptr);
20459  *v = vn->value.data.value;
20461  return UA_STATUSCODE_GOOD;
20462 }
20463 
20464 static UA_StatusCode
20465 readValueAttributeFromDataSource(const UA_VariableNode *vn, UA_DataValue *v,
20466  UA_TimestampsToReturn timestamps,
20467  UA_NumericRange *rangeptr) {
20468  if(!vn->value.dataSource.read)
20470  UA_Boolean sourceTimeStamp = (timestamps == UA_TIMESTAMPSTORETURN_SOURCE ||
20471  timestamps == UA_TIMESTAMPSTORETURN_BOTH);
20472 
20473  UA_RCU_UNLOCK();
20474  UA_StatusCode retval =
20475  vn->value.dataSource.read(vn->value.dataSource.handle, vn->nodeId,
20476  sourceTimeStamp, rangeptr, v);
20477  UA_RCU_LOCK();
20478  return retval;
20479 }
20480 
20481 static UA_StatusCode
20482 readValueAttributeComplete(UA_Server *server, const UA_VariableNode *vn,
20483  UA_TimestampsToReturn timestamps, const UA_String *indexRange,
20484  UA_DataValue *v) {
20485  /* Compute the index range */
20486  UA_NumericRange range;
20487  UA_NumericRange *rangeptr = NULL;
20489  if(indexRange && indexRange->length > 0) {
20490  retval = parse_numericrange(indexRange, &range);
20491  if(retval != UA_STATUSCODE_GOOD)
20492  return retval;
20493  rangeptr = &range;
20494  }
20495 
20496  /* Read the value */
20497  if(vn->valueSource == UA_VALUESOURCE_DATA)
20498  retval = readValueAttributeFromNode(server, vn, v, rangeptr);
20499  else
20500  retval = readValueAttributeFromDataSource(vn, v, timestamps, rangeptr);
20501 
20502  /* Clean up */
20503  if(rangeptr)
20504  UA_free(range.dimensions);
20505  return retval;
20506 }
20507 
20509 readValueAttribute(UA_Server *server, const UA_VariableNode *vn, UA_DataValue *v) {
20510  return readValueAttributeComplete(server, vn, UA_TIMESTAMPSTORETURN_NEITHER, NULL, v);
20511 }
20512 
20513 static UA_StatusCode
20514 writeValueAttributeWithoutRange(UA_VariableNode *node, const UA_DataValue *value) {
20515  UA_DataValue old_value = node->value.data.value; /* keep the pointers for restoring */
20516  UA_StatusCode retval = UA_DataValue_copy(value, &node->value.data.value);
20517  if(retval == UA_STATUSCODE_GOOD)
20518  UA_DataValue_deleteMembers(&old_value);
20519  else
20520  node->value.data.value = old_value;
20521  return retval;
20522 }
20523 
20524 static UA_StatusCode
20525 writeValueAttributeWithRange(UA_VariableNode *node, const UA_DataValue *value,
20526  const UA_NumericRange *rangeptr) {
20527  /* Value on both sides? */
20528  if(value->status != node->value.data.value.status ||
20529  !value->hasValue || !node->value.data.value.hasValue)
20531 
20532  /* Make scalar a one-entry array for range matching */
20533  UA_Variant editableValue;
20534  const UA_Variant *v = &value->value;
20535  if(UA_Variant_isScalar(&value->value)) {
20536  editableValue = value->value;
20537  editableValue.arrayLength = 1;
20538  v = &editableValue;
20539  }
20540 
20541  /* Write the value */
20542  UA_StatusCode retval = UA_Variant_setRangeCopy(&node->value.data.value.value,
20543  v->data, v->arrayLength, *rangeptr);
20544  if(retval != UA_STATUSCODE_GOOD)
20545  return retval;
20546 
20547  /* Write the status and timestamps */
20548  node->value.data.value.hasStatus = value->hasStatus;
20549  node->value.data.value.status = value->status;
20550  node->value.data.value.hasSourceTimestamp = value->hasSourceTimestamp;
20551  node->value.data.value.sourceTimestamp = value->sourceTimestamp;
20552  node->value.data.value.hasSourcePicoseconds = value->hasSourcePicoseconds;
20553  node->value.data.value.sourcePicoseconds = value->sourcePicoseconds;
20554  return UA_STATUSCODE_GOOD;
20555 }
20556 
20558 writeValueAttribute(UA_Server *server, UA_VariableNode *node,
20559  const UA_DataValue *value, const UA_String *indexRange) {
20560  /* Parse the range */
20561  UA_NumericRange range;
20562  UA_NumericRange *rangeptr = NULL;
20564  if(indexRange && indexRange->length > 0) {
20565  retval = parse_numericrange(indexRange, &range);
20566  if(retval != UA_STATUSCODE_GOOD)
20567  return retval;
20568  rangeptr = &range;
20569  }
20570 
20571  /* Copy the value into an editable "container" where e.g. the datatype can
20572  * be adjusted. The data itself is not written into. */
20573  UA_DataValue editableValue = *value;
20574  editableValue.value.storageType = UA_VARIANT_DATA_NODELETE;
20575 
20576  /* Type checking. May change the type of editableValue */
20577  if(value->hasValue) {
20578  retval = typeCheckValue(server, &node->dataType, node->valueRank,
20579  node->arrayDimensionsSize, node->arrayDimensions,
20580  &value->value, rangeptr, &editableValue.value);
20581  if(retval != UA_STATUSCODE_GOOD)
20582  goto cleanup;
20583  }
20584 
20585  /* Set the source timestamp if there is none */
20586  if(!editableValue.hasSourceTimestamp) {
20587  editableValue.sourceTimestamp = UA_DateTime_now();
20588  editableValue.hasSourceTimestamp = true;
20589  }
20590 
20591  /* Ok, do it */
20592  if(node->valueSource == UA_VALUESOURCE_DATA) {
20593  if(!rangeptr)
20594  retval = writeValueAttributeWithoutRange(node, &editableValue);
20595  else
20596  retval = writeValueAttributeWithRange(node, &editableValue, rangeptr);
20597 
20598  /* Callback after writing */
20599  if(retval == UA_STATUSCODE_GOOD && node->value.data.callback.onWrite) {
20600  const UA_VariableNode *writtenNode;
20601 #ifdef UA_ENABLE_MULTITHREADING
20602  /* Reopen the node to see the changes (multithreading only) */
20603  writtenNode = (const UA_VariableNode*)UA_NodeStore_get(server->nodestore, &node->nodeId);
20604 #else
20605  writtenNode = node; /* The node is written in-situ (TODO: this might
20606  change with the nodestore plugin approach) */
20607 #endif
20608  UA_RCU_UNLOCK();
20609  writtenNode->value.data.callback.onWrite(writtenNode->value.data.callback.handle,
20610  writtenNode->nodeId,
20611  &writtenNode->value.data.value.value, rangeptr);
20612  UA_RCU_LOCK();
20613  }
20614  } else {
20615  if(node->value.dataSource.write) {
20616  UA_RCU_UNLOCK();
20617  retval = node->value.dataSource.write(node->value.dataSource.handle,
20618  node->nodeId, &editableValue.value, rangeptr);
20619  UA_RCU_LOCK();
20620  } else {
20622  }
20623  }
20624 
20625  /* Clean up */
20626  cleanup:
20627  if(rangeptr)
20628  UA_free(range.dimensions);
20629  return retval;
20630 }
20631 
20632 /************************/
20633 /* IsAbstract Attribute */
20634 /************************/
20635 
20636 static UA_StatusCode
20637 readIsAbstractAttribute(const UA_Node *node, UA_Variant *v) {
20638  const UA_Boolean *isAbstract;
20639  switch(node->nodeClass) {
20641  isAbstract = &((const UA_ReferenceTypeNode*)node)->isAbstract;
20642  break;
20644  isAbstract = &((const UA_ObjectTypeNode*)node)->isAbstract;
20645  break;
20647  isAbstract = &((const UA_VariableTypeNode*)node)->isAbstract;
20648  break;
20649  case UA_NODECLASS_DATATYPE:
20650  isAbstract = &((const UA_DataTypeNode*)node)->isAbstract;
20651  break;
20652  default:
20654  }
20655  forceVariantSetScalar(v, isAbstract, &UA_TYPES[UA_TYPES_BOOLEAN]);
20656  return UA_STATUSCODE_GOOD;
20657 }
20658 
20659 static UA_StatusCode
20660 writeIsAbstractAttribute(UA_Node *node, UA_Boolean value) {
20661  switch(node->nodeClass) {
20663  ((UA_ObjectTypeNode*)node)->isAbstract = value;
20664  break;
20666  ((UA_ReferenceTypeNode*)node)->isAbstract = value;
20667  break;
20669  ((UA_VariableTypeNode*)node)->isAbstract = value;
20670  break;
20671  case UA_NODECLASS_DATATYPE:
20672  ((UA_DataTypeNode*)node)->isAbstract = value;
20673  break;
20674  default:
20676  }
20677  return UA_STATUSCODE_GOOD;
20678 }
20679 
20680 /****************/
20681 /* Read Service */
20682 /****************/
20683 
20684 static const UA_String binEncoding = {sizeof("Default Binary")-1, (UA_Byte*)"Default Binary"};
20685 /* static const UA_String xmlEncoding = {sizeof("Default Xml")-1, (UA_Byte*)"Default Xml"}; */
20686 
20687 #define CHECK_NODECLASS(CLASS) \
20688  if(!(node->nodeClass & (CLASS))) { \
20689  retval = UA_STATUSCODE_BADATTRIBUTEIDINVALID; \
20690  break; \
20691  }
20692 
20693 void Service_Read_single(UA_Server *server, UA_Session *session,
20694  const UA_TimestampsToReturn timestamps,
20695  const UA_ReadValueId *id, UA_DataValue *v) {
20696  UA_LOG_DEBUG_SESSION(server->config.logger, session,
20697  "Read the attribute %i", id->attributeId);
20698 
20699  /* XML encoding is not supported */
20700  if(id->dataEncoding.name.length > 0 &&
20701  !UA_String_equal(&binEncoding, &id->dataEncoding.name)) {
20702  v->hasStatus = true;
20704  return;
20705  }
20706 
20707  /* Index range for an attribute other than value */
20708  if(id->indexRange.length > 0 && id->attributeId != UA_ATTRIBUTEID_VALUE) {
20709  v->hasStatus = true;
20711  return;
20712  }
20713 
20714  /* Get the node */
20715  const UA_Node *node = UA_NodeStore_get(server->nodestore, &id->nodeId);
20716  if(!node) {
20717  v->hasStatus = true;
20719  return;
20720  }
20721 
20722  /* Read the attribute */
20724  switch(id->attributeId) {
20725  case UA_ATTRIBUTEID_NODEID:
20726  forceVariantSetScalar(&v->value, &node->nodeId, &UA_TYPES[UA_TYPES_NODEID]);
20727  break;
20729  forceVariantSetScalar(&v->value, &node->nodeClass, &UA_TYPES[UA_TYPES_NODECLASS]);
20730  break;
20732  forceVariantSetScalar(&v->value, &node->browseName, &UA_TYPES[UA_TYPES_QUALIFIEDNAME]);
20733  break;
20735  forceVariantSetScalar(&v->value, &node->displayName, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
20736  break;
20738  forceVariantSetScalar(&v->value, &node->description, &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
20739  break;
20741  forceVariantSetScalar(&v->value, &node->writeMask, &UA_TYPES[UA_TYPES_UINT32]);
20742  break;
20744  forceVariantSetScalar(&v->value, &node->userWriteMask, &UA_TYPES[UA_TYPES_UINT32]);
20745  break;
20747  retval = readIsAbstractAttribute(node, &v->value);
20748  break;
20751  forceVariantSetScalar(&v->value, &((const UA_ReferenceTypeNode*)node)->symmetric,
20753  break;
20756  forceVariantSetScalar(&v->value, &((const UA_ReferenceTypeNode*)node)->inverseName,
20757  &UA_TYPES[UA_TYPES_LOCALIZEDTEXT]);
20758  break;
20761  forceVariantSetScalar(&v->value, &((const UA_ViewNode*)node)->containsNoLoops,
20762  &UA_TYPES[UA_TYPES_BOOLEAN]);
20763  break;
20766  forceVariantSetScalar(&v->value, &((const UA_ViewNode*)node)->eventNotifier,
20768  break;
20769  case UA_ATTRIBUTEID_VALUE:
20771  retval = readValueAttributeComplete(server, (const UA_VariableNode*)node,
20772  timestamps, &id->indexRange, v);
20773  break;
20776  forceVariantSetScalar(&v->value, &((const UA_VariableTypeNode*)node)->dataType,
20777  &UA_TYPES[UA_TYPES_NODEID]);
20778  break;
20781  forceVariantSetScalar(&v->value, &((const UA_VariableTypeNode*)node)->valueRank,
20783  break;
20786  retval = readArrayDimensionsAttribute((const UA_VariableNode*)node, v);
20787  break;
20790  forceVariantSetScalar(&v->value, &((const UA_VariableNode*)node)->accessLevel,
20791  &UA_TYPES[UA_TYPES_BYTE]);
20792  break;
20795  forceVariantSetScalar(&v->value, &((const UA_VariableNode*)node)->userAccessLevel,
20796  &UA_TYPES[UA_TYPES_BYTE]);
20797  break;
20800  forceVariantSetScalar(&v->value, &((const UA_VariableNode*)node)->minimumSamplingInterval,
20802  break;
20805  forceVariantSetScalar(&v->value, &((const UA_VariableNode*)node)->historizing,
20806  &UA_TYPES[UA_TYPES_BOOLEAN]);
20807  break;
20810  forceVariantSetScalar(&v->value, &((const UA_MethodNode*)node)->executable,
20811  &UA_TYPES[UA_TYPES_BOOLEAN]);
20812  break;
20815  forceVariantSetScalar(&v->value, &((const UA_MethodNode*)node)->userExecutable,
20816  &UA_TYPES[UA_TYPES_BOOLEAN]);
20817  break;
20818  default:
20820  }
20821 
20822  /* Return error code when reading has failed */
20823  if(retval != UA_STATUSCODE_GOOD) {
20824  v->hasStatus = true;
20825  v->status = retval;
20826  return;
20827  }
20828 
20829  v->hasValue = true;
20830 
20831  /* Create server timestamp */
20832  if(timestamps == UA_TIMESTAMPSTORETURN_SERVER ||
20833  timestamps == UA_TIMESTAMPSTORETURN_BOTH) {
20835  v->hasServerTimestamp = true;
20836  }
20837 
20838  /* Handle source time stamp */
20839  if(id->attributeId == UA_ATTRIBUTEID_VALUE) {
20840  if (timestamps == UA_TIMESTAMPSTORETURN_SERVER ||
20841  timestamps == UA_TIMESTAMPSTORETURN_NEITHER) {
20842  v->hasSourceTimestamp = false;
20843  v->hasSourcePicoseconds = false;
20844  } else if(!v->hasSourceTimestamp) {
20846  v->hasSourceTimestamp = true;
20847  }
20848  }
20849 }
20850 
20851 void Service_Read(UA_Server *server, UA_Session *session,
20852  const UA_ReadRequest *request, UA_ReadResponse *response) {
20853  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing ReadRequest");
20854  if(request->nodesToReadSize <= 0) {
20856  return;
20857  }
20858 
20859  /* check if the timestampstoreturn is valid */
20862  return;
20863  }
20864 
20865  size_t size = request->nodesToReadSize;
20866  response->results = UA_Array_new(size, &UA_TYPES[UA_TYPES_DATAVALUE]);
20867  if(!response->results) {
20869  return;
20870  }
20871  response->resultsSize = size;
20872 
20873  if(request->maxAge < 0) {
20875  return;
20876  }
20877 
20878  for(size_t i = 0;i < size;++i) {
20879  Service_Read_single(server, session, request->timestampsToReturn,
20880  &request->nodesToRead[i], &response->results[i]);
20881  }
20882 
20883 #ifdef UA_ENABLE_NONSTANDARD_STATELESS
20884  /* Add an expiry header for caching */
20885  if(session->sessionId.namespaceIndex == 0 &&
20887  session->sessionId.identifier.numeric == 0){
20888  UA_ExtensionObject additionalHeader;
20889  UA_ExtensionObject_init(&additionalHeader);
20891  additionalHeader.content.encoded.typeId =UA_TYPES[UA_TYPES_VARIANT].typeId;
20892 
20893  UA_Variant variant;
20894  UA_Variant_init(&variant);
20895 
20896  UA_DateTime* expireArray = NULL;
20897  expireArray = UA_Array_new(request->nodesToReadSize,
20899  variant.data = expireArray;
20900 
20901  /* expires in 20 seconds */
20902  for(UA_UInt32 i = 0;i < response->resultsSize;++i) {
20903  expireArray[i] = UA_DateTime_now() + 20 * 100 * 1000 * 1000;
20904  }
20905  UA_Variant_setArray(&variant, expireArray, request->nodesToReadSize,
20906  &UA_TYPES[UA_TYPES_DATETIME]);
20907 
20908  size_t offset = 0;
20909  UA_ByteString str;
20910  size_t strlength = UA_calcSizeBinary(&variant, &UA_TYPES[UA_TYPES_VARIANT]);
20911  UA_ByteString_allocBuffer(&str, strlength);
20912  /* No chunking callback for the encoding */
20913  UA_StatusCode retval = UA_encodeBinary(&variant, &UA_TYPES[UA_TYPES_VARIANT],
20914  NULL, NULL, &str, &offset);
20915  UA_Array_delete(expireArray, request->nodesToReadSize, &UA_TYPES[UA_TYPES_DATETIME]);
20916  if(retval == UA_STATUSCODE_GOOD){
20917  additionalHeader.content.encoded.body.data = str.data;
20918  additionalHeader.content.encoded.body.length = offset;
20919  response->responseHeader.additionalHeader = additionalHeader;
20920  }
20921  }
20922 #endif
20923 }
20924 
20925 /* Exposes the Read service to local users */
20927 UA_Server_read(UA_Server *server, const UA_ReadValueId *item,
20928  UA_TimestampsToReturn timestamps) {
20929  UA_DataValue dv;
20930  UA_DataValue_init(&dv);
20931  UA_RCU_LOCK();
20932  Service_Read_single(server, &adminSession, timestamps, item, &dv);
20933  UA_RCU_UNLOCK();
20934  return dv;
20935 }
20936 
20937 /* Used in inline functions exposing the Read service with more syntactic sugar
20938  * for individual attributes */
20940 __UA_Server_read(UA_Server *server, const UA_NodeId *nodeId,
20941  const UA_AttributeId attributeId, void *v) {
20942  /* Call the read service */
20943  UA_ReadValueId item;
20944  UA_ReadValueId_init(&item);
20945  item.nodeId = *nodeId;
20946  item.attributeId = attributeId;
20948 
20949  /* Check the return value */
20951  if(dv.hasStatus)
20952  retval = dv.status;
20953  else if(!dv.hasValue)
20955  if(retval != UA_STATUSCODE_GOOD) {
20956  UA_DataValue_deleteMembers(&dv);
20957  return retval;
20958  }
20959 
20960  /* Prepare the result */
20961  if(attributeId == UA_ATTRIBUTEID_VALUE ||
20962  attributeId == UA_ATTRIBUTEID_ARRAYDIMENSIONS) {
20963  /* Return the entire variant */
20965  retval = UA_Variant_copy(&dv.value, v);
20966  } else {
20967  /* storageType is UA_VARIANT_DATA. Copy the entire variant
20968  * (including pointers and all) */
20969  memcpy(v, &dv.value, sizeof(UA_Variant));
20970  }
20971  } else {
20972  /* Return the variant content only */
20974  retval = UA_copy(dv.value.data, v, dv.value.type);
20975  } else {
20976  /* storageType is UA_VARIANT_DATA. Copy the content of the type
20977  * (including pointers and all) */
20978  memcpy(v, dv.value.data, dv.value.type->memSize);
20979  /* Delete the "carrier" in the variant */
20980  UA_free(dv.value.data);
20981  }
20982  }
20983  return retval;
20984 }
20985 
20986 /*****************/
20987 /* Write Service */
20988 /*****************/
20989 
20990 #define CHECK_DATATYPE_SCALAR(EXP_DT) \
20991  if(!wvalue->value.hasValue || \
20992  &UA_TYPES[UA_TYPES_##EXP_DT] != wvalue->value.value.type || \
20993  !UA_Variant_isScalar(&wvalue->value.value)) { \
20994  retval = UA_STATUSCODE_BADTYPEMISMATCH; \
20995  break; \
20996  }
20997 
20998 #define CHECK_DATATYPE_ARRAY(EXP_DT) \
20999  if(!wvalue->value.hasValue || \
21000  &UA_TYPES[UA_TYPES_##EXP_DT] != wvalue->value.value.type || \
21001  UA_Variant_isScalar(&wvalue->value.value)) { \
21002  retval = UA_STATUSCODE_BADTYPEMISMATCH; \
21003  break; \
21004  }
21005 
21006 #define CHECK_NODECLASS_WRITE(CLASS) \
21007  if((node->nodeClass & (CLASS)) == 0) { \
21008  retval = UA_STATUSCODE_BADNODECLASSINVALID; \
21009  break; \
21010  }
21011 
21012 /* This function implements the main part of the write service and operates on a
21013  copy of the node (not in single-threaded mode). */
21014 static UA_StatusCode
21015 CopyAttributeIntoNode(UA_Server *server, UA_Session *session,
21016  UA_Node *node, const UA_WriteValue *wvalue) {
21017  const void *value = wvalue->value.value.data;
21019  switch(wvalue->attributeId) {
21020  case UA_ATTRIBUTEID_NODEID:
21023  break;
21025  CHECK_DATATYPE_SCALAR(QUALIFIEDNAME);
21026  UA_QualifiedName_deleteMembers(&node->browseName);
21027  UA_QualifiedName_copy(value, &node->browseName);
21028  break;
21030  CHECK_DATATYPE_SCALAR(LOCALIZEDTEXT);
21031  UA_LocalizedText_deleteMembers(&node->displayName);
21032  UA_LocalizedText_copy(value, &node->displayName);
21033  break;
21035  CHECK_DATATYPE_SCALAR(LOCALIZEDTEXT);
21036  UA_LocalizedText_deleteMembers(&node->description);
21037  UA_LocalizedText_copy(value, &node->description);
21038  break;
21040  CHECK_DATATYPE_SCALAR(UINT32);
21041  node->writeMask = *(const UA_UInt32*)value;
21042  break;
21044  CHECK_DATATYPE_SCALAR(UINT32);
21045  node->userWriteMask = *(const UA_UInt32*)value;
21046  break;
21048  CHECK_DATATYPE_SCALAR(BOOLEAN);
21049  retval = writeIsAbstractAttribute(node, *(const UA_Boolean*)value);
21050  break;
21053  CHECK_DATATYPE_SCALAR(BOOLEAN);
21054  ((UA_ReferenceTypeNode*)node)->symmetric = *(const UA_Boolean*)value;
21055  break;
21058  CHECK_DATATYPE_SCALAR(LOCALIZEDTEXT);
21059  UA_LocalizedText_deleteMembers(&((UA_ReferenceTypeNode*)node)->inverseName);
21060  UA_LocalizedText_copy(value, &((UA_ReferenceTypeNode*)node)->inverseName);
21061  break;
21064  CHECK_DATATYPE_SCALAR(BOOLEAN);
21065  ((UA_ViewNode*)node)->containsNoLoops = *(const UA_Boolean*)value;
21066  break;
21069  CHECK_DATATYPE_SCALAR(BYTE);
21070  ((UA_ViewNode*)node)->eventNotifier = *(const UA_Byte*)value;
21071  break;
21072  case UA_ATTRIBUTEID_VALUE:
21074  retval = writeValueAttribute(server, (UA_VariableNode*)node,
21075  &wvalue->value, &wvalue->indexRange);
21076  break;
21079  CHECK_DATATYPE_SCALAR(NODEID);
21080  retval = writeDataTypeAttributeWithVT(server, (UA_VariableNode*)node, (const UA_NodeId*)value);
21081  break;
21084  CHECK_DATATYPE_SCALAR(INT32);
21085  retval = writeValueRankAttributeWithVT(server, (UA_VariableNode*)node, *(const UA_Int32*)value);
21086  break;
21089  CHECK_DATATYPE_ARRAY(UINT32);
21090  retval = writeArrayDimensionsAttribute(server, (UA_VariableNode*)node,
21091  wvalue->value.value.arrayLength,
21092  wvalue->value.value.data);
21093  break;
21096  CHECK_DATATYPE_SCALAR(BYTE);
21097  ((UA_VariableNode*)node)->accessLevel = *(const UA_Byte*)value;
21098  break;
21101  CHECK_DATATYPE_SCALAR(BYTE);
21102  ((UA_VariableNode*)node)->userAccessLevel = *(const UA_Byte*)value;
21103  break;
21106  CHECK_DATATYPE_SCALAR(DOUBLE);
21107  ((UA_VariableNode*)node)->minimumSamplingInterval = *(const UA_Double*)value;
21108  break;
21111  CHECK_DATATYPE_SCALAR(BOOLEAN);
21112  ((UA_VariableNode*)node)->historizing = *(const UA_Boolean*)value;
21113  break;
21116  CHECK_DATATYPE_SCALAR(BOOLEAN);
21117  ((UA_MethodNode*)node)->executable = *(const UA_Boolean*)value;
21118  break;
21121  CHECK_DATATYPE_SCALAR(BOOLEAN);
21122  ((UA_MethodNode*)node)->userExecutable = *(const UA_Boolean*)value;
21123  break;
21124  default:
21126  break;
21127  }
21128  if(retval != UA_STATUSCODE_GOOD)
21129  UA_LOG_INFO_SESSION(server->config.logger, session,
21130  "WriteRequest returned status code %s",
21131  UA_StatusCode_name(retval));
21132  return retval;
21133 }
21134 
21135 void
21136 Service_Write(UA_Server *server, UA_Session *session,
21137  const UA_WriteRequest *request, UA_WriteResponse *response) {
21138  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing WriteRequest");
21139  if(request->nodesToWriteSize <= 0) {
21141  return;
21142  }
21143 
21145  if(!response->results) {
21147  return;
21148  }
21149  response->resultsSize = request->nodesToWriteSize;
21150 
21151  for(size_t i = 0;i < request->nodesToWriteSize;++i) {
21152  response->results[i] = UA_Server_editNode(server, session, &request->nodesToWrite[i].nodeId,
21153  (UA_EditNodeCallback)CopyAttributeIntoNode,
21154  &request->nodesToWrite[i]);
21155  }
21156 }
21157 
21159 UA_Server_write(UA_Server *server, const UA_WriteValue *value) {
21160  UA_RCU_LOCK();
21161  UA_StatusCode retval =
21162  UA_Server_editNode(server, &adminSession, &value->nodeId,
21163  (UA_EditNodeCallback)CopyAttributeIntoNode, value);
21164  UA_RCU_UNLOCK();
21165  return retval;
21166 }
21167 
21168 /* Convenience function to be wrapped into inline functions */
21170 __UA_Server_write(UA_Server *server, const UA_NodeId *nodeId,
21171  const UA_AttributeId attributeId,
21172  const UA_DataType *attr_type,
21173  const void *attr) {
21174  UA_WriteValue wvalue;
21175  UA_WriteValue_init(&wvalue);
21176  wvalue.nodeId = *nodeId;
21177  wvalue.attributeId = attributeId;
21178  wvalue.value.hasValue = true;
21179  if(attr_type != &UA_TYPES[UA_TYPES_VARIANT]) {
21180  /* hacked cast. the target WriteValue is used as const anyway */
21181  UA_Variant_setScalar(&wvalue.value.value, (void*)(uintptr_t)attr, attr_type);
21182  } else {
21183  wvalue.value.value = *(const UA_Variant*)attr;
21184  }
21185  return UA_Server_write(server, &wvalue);
21186 }
21187 
21188 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_nodemanagement.c" ***********************************/
21189 
21190 /* This Source Code Form is subject to the terms of the Mozilla Public
21191  * License, v. 2.0. If a copy of the MPL was not distributed with this
21192  * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
21193 
21194 
21195 /************************/
21196 /* Forward Declarations */
21197 /************************/
21198 
21199 static UA_StatusCode
21200 addReference(UA_Server *server, UA_Session *session,
21201  const UA_AddReferencesItem *item);
21202 
21203 static UA_StatusCode
21204 deleteReference(UA_Server *server, UA_Session *session,
21205  const UA_DeleteReferencesItem *item);
21206 
21207 static UA_StatusCode
21208 deleteNode(UA_Server *server, UA_Session *session,
21209  const UA_NodeId *nodeId, UA_Boolean deleteReferences);
21210 
21211 /**********************/
21212 /* Consistency Checks */
21213 /**********************/
21214 
21215 /* Check if the requested parent node exists, has the right node class and is
21216  * referenced with an allowed (hierarchical) reference type. For "type" nodes,
21217  * only hasSubType references are allowed. */
21218 static UA_StatusCode
21219 checkParentReference(UA_Server *server, UA_Session *session, UA_NodeClass nodeClass,
21220  const UA_NodeId *parentNodeId, const UA_NodeId *referenceTypeId) {
21221  /* Objects do not need a parent (e.g. mandatory/optional modellingrules) */
21222  if(nodeClass == UA_NODECLASS_OBJECT && UA_NodeId_isNull(parentNodeId) &&
21223  UA_NodeId_isNull(referenceTypeId))
21224  return UA_STATUSCODE_GOOD;
21225 
21226  /* See if the parent exists */
21227  const UA_Node *parent = UA_NodeStore_get(server->nodestore, parentNodeId);
21228  if(!parent) {
21229  UA_LOG_INFO_SESSION(server->config.logger, session,
21230  "AddNodes: Parent node not found");
21232  }
21233 
21234  /* Check the referencetype exists */
21235  const UA_ReferenceTypeNode *referenceType =
21236  (const UA_ReferenceTypeNode*)UA_NodeStore_get(server->nodestore, referenceTypeId);
21237  if(!referenceType) {
21238  UA_LOG_INFO_SESSION(server->config.logger, session,
21239  "AddNodes: Reference type to the parent not found");
21241  }
21242 
21243  /* Check if the referencetype is a reference type node */
21244  if(referenceType->nodeClass != UA_NODECLASS_REFERENCETYPE) {
21245  UA_LOG_INFO_SESSION(server->config.logger, session,
21246  "AddNodes: Reference type to the parent invalid");
21248  }
21249 
21250  /* Check that the reference type is not abstract */
21251  if(referenceType->isAbstract == true) {
21252  UA_LOG_INFO_SESSION(server->config.logger, session,
21253  "AddNodes: Abstract reference type to the parent not allowed");
21255  }
21256 
21257  /* Check hassubtype relation for type nodes */
21258  const UA_NodeId subtypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE);
21259  if(nodeClass == UA_NODECLASS_DATATYPE ||
21260  nodeClass == UA_NODECLASS_VARIABLETYPE ||
21261  nodeClass == UA_NODECLASS_OBJECTTYPE ||
21262  nodeClass == UA_NODECLASS_REFERENCETYPE) {
21263  /* type needs hassubtype reference to the supertype */
21264  if(!UA_NodeId_equal(referenceTypeId, &subtypeId)) {
21265  UA_LOG_INFO_SESSION(server->config.logger, session,
21266  "AddNodes: New type node need to have a "
21267  "HasSubType reference");
21269  }
21270  /* supertype needs to be of the same node type */
21271  if(parent->nodeClass != nodeClass) {
21272  UA_LOG_INFO_SESSION(server->config.logger, session,
21273  "AddNodes: New type node needs to be of the same "
21274  "node type as the parent");
21276  }
21277  return UA_STATUSCODE_GOOD;
21278  }
21279 
21280  /* Test if the referencetype is hierarchical */
21281  const UA_NodeId hierarchicalReference =
21282  UA_NODEID_NUMERIC(0, UA_NS0ID_HIERARCHICALREFERENCES);
21283  if(!isNodeInTree(server->nodestore, referenceTypeId,
21284  &hierarchicalReference, &subtypeId, 1)) {
21285  UA_LOG_INFO_SESSION(server->config.logger, session,
21286  "AddNodes: Reference type is not hierarchical");
21288  }
21289 
21290  return UA_STATUSCODE_GOOD;
21291 }
21292 
21293 /************/
21294 /* Add Node */
21295 /************/
21296 
21297 static void
21298 Service_AddNodes_single(UA_Server *server, UA_Session *session,
21299  const UA_AddNodesItem *item, UA_AddNodesResult *result,
21300  UA_InstantiationCallback *instantiationCallback);
21301 
21302 static UA_StatusCode
21303 copyChildNodesToNode(UA_Server *server, UA_Session *session,
21304  const UA_NodeId *sourceNodeId, const UA_NodeId *destinationNodeId,
21305  UA_InstantiationCallback *instantiationCallback);
21306 
21307 /* copy an existing variable under the given parent. then instantiate the
21308  * variable for its type */
21309 static UA_StatusCode
21310 copyExistingVariable(UA_Server *server, UA_Session *session, const UA_NodeId *variable,
21311  const UA_NodeId *referenceType, const UA_NodeId *parent,
21312  UA_InstantiationCallback *instantiationCallback) {
21313  const UA_VariableNode *node =
21314  (const UA_VariableNode*)UA_NodeStore_get(server->nodestore, variable);
21315  if(!node)
21317  if(node->nodeClass != UA_NODECLASS_VARIABLE)
21319 
21320  /* Get the current value */
21321  UA_DataValue value;
21322  UA_DataValue_init(&value);
21323  UA_StatusCode retval = readValueAttribute(server, node, &value);
21324  if(retval != UA_STATUSCODE_GOOD)
21325  return retval;
21326 
21327  /* Prepare the variable description */
21328  UA_VariableAttributes attr;
21329  UA_VariableAttributes_init(&attr);
21330  attr.displayName = node->displayName;
21331  attr.description = node->description;
21332  attr.writeMask = node->writeMask;
21333  attr.userWriteMask = node->userWriteMask;
21334  attr.value = value.value;
21335  attr.dataType = node->dataType;
21336  attr.valueRank = node->valueRank;
21337  attr.arrayDimensionsSize = node->arrayDimensionsSize;
21338  attr.arrayDimensions = node->arrayDimensions;
21339  attr.accessLevel = node->accessLevel;
21340  attr.userAccessLevel = node->userAccessLevel;
21342  attr.historizing = node->historizing;
21343 
21344  UA_AddNodesItem item;
21345  UA_AddNodesItem_init(&item);
21347  item.parentNodeId.nodeId = *parent;
21348  item.referenceTypeId = *referenceType;
21349  item.browseName = node->browseName;
21352  item.nodeAttributes.content.decoded.data = &attr;
21353  const UA_VariableTypeNode *vt = (const UA_VariableTypeNode*)getNodeType(server, (const UA_Node*)node);
21354  if(!vt || vt->nodeClass != UA_NODECLASS_VARIABLETYPE || vt->isAbstract) {
21356  goto cleanup;
21357  }
21358  item.typeDefinition.nodeId = vt->nodeId;
21359 
21360  /* Add the variable and instantiate the children */
21361  UA_AddNodesResult res;
21362  UA_AddNodesResult_init(&res);
21363  Service_AddNodes_single(server, session, &item, &res, instantiationCallback);
21364  if(res.statusCode != UA_STATUSCODE_GOOD) {
21365  retval = res.statusCode;
21366  goto cleanup;
21367  }
21368  retval = copyChildNodesToNode(server, session, &node->nodeId,
21369  &res.addedNodeId, instantiationCallback);
21370 
21371  if(retval == UA_STATUSCODE_GOOD && instantiationCallback)
21372  instantiationCallback->method(res.addedNodeId, node->nodeId,
21373  instantiationCallback->handle);
21374 
21375  UA_NodeId_deleteMembers(&res.addedNodeId);
21376  cleanup:
21377  if(value.hasValue && value.value.storageType == UA_VARIANT_DATA)
21378  UA_Variant_deleteMembers(&value.value);
21379  return retval;
21380 }
21381 
21382 /* Copy an existing object under the given parent. Then instantiate for all
21383  * hastypedefinitions of the original version. */
21384 static UA_StatusCode
21385 copyExistingObject(UA_Server *server, UA_Session *session, const UA_NodeId *object,
21386  const UA_NodeId *referenceType, const UA_NodeId *parent,
21387  UA_InstantiationCallback *instantiationCallback) {
21388  const UA_ObjectNode *node =
21389  (const UA_ObjectNode*)UA_NodeStore_get(server->nodestore, object);
21390  if(!node)
21392  if(node->nodeClass != UA_NODECLASS_OBJECT)
21394 
21395  /* Prepare the item */
21396  UA_ObjectAttributes attr;
21397  UA_ObjectAttributes_init(&attr);
21398  attr.displayName = node->displayName;
21399  attr.description = node->description;
21400  attr.writeMask = node->writeMask;
21401  attr.userWriteMask = node->userWriteMask;
21402  attr.eventNotifier = node->eventNotifier;
21403 
21404  UA_AddNodesItem item;
21405  UA_AddNodesItem_init(&item);
21407  item.parentNodeId.nodeId = *parent;
21408  item.referenceTypeId = *referenceType;
21409  item.browseName = node->browseName;
21412  item.nodeAttributes.content.decoded.data = &attr;
21413  const UA_ObjectTypeNode *objtype = (const UA_ObjectTypeNode*)getNodeType(server, (const UA_Node*)node);
21414  if(!objtype || objtype->nodeClass != UA_NODECLASS_OBJECTTYPE || objtype->isAbstract)
21416  item.typeDefinition.nodeId = objtype->nodeId;
21417 
21418  /* add the new object */
21419  UA_AddNodesResult res;
21420  UA_AddNodesResult_init(&res);
21421  Service_AddNodes_single(server, session, &item, &res, instantiationCallback);
21422  if(res.statusCode != UA_STATUSCODE_GOOD)
21423  return res.statusCode;
21424 
21425  /* Copy any aggregated/nested variables/methods/subobjects this object contains
21426  * These objects may not be part of the nodes type. */
21427  UA_StatusCode retval = copyChildNodesToNode(server, session, &node->nodeId,
21428  &res.addedNodeId, instantiationCallback);
21429  if(retval == UA_STATUSCODE_GOOD && instantiationCallback)
21430  instantiationCallback->method(res.addedNodeId, node->nodeId,
21431  instantiationCallback->handle);
21432 
21433  UA_NodeId_deleteMembers(&res.addedNodeId);
21434  return retval;
21435 }
21436 
21437 static UA_StatusCode
21438 setObjectInstanceHandle(UA_Server *server, UA_Session *session,
21439  UA_ObjectNode* node, void * (*constructor)(const UA_NodeId instance)) {
21440  if(node->nodeClass != UA_NODECLASS_OBJECT)
21442  if(!node->instanceHandle)
21443  node->instanceHandle = constructor(node->nodeId);
21444  return UA_STATUSCODE_GOOD;
21445 }
21446 
21447 static UA_StatusCode
21448 instantiateNode(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId,
21449  UA_NodeClass nodeClass, const UA_NodeId *typeId,
21450  UA_InstantiationCallback *instantiationCallback) {
21451  /* see if the type node is correct */
21452  const UA_Node *typenode = UA_NodeStore_get(server->nodestore, typeId);
21453  if(!typenode)
21455  if(nodeClass == UA_NODECLASS_VARIABLE) {
21456  if(typenode->nodeClass != UA_NODECLASS_VARIABLETYPE ||
21457  ((const UA_VariableTypeNode*)typenode)->isAbstract)
21459  } else if(nodeClass == UA_NODECLASS_OBJECT) {
21460  if(typenode->nodeClass != UA_NODECLASS_OBJECTTYPE ||
21461  ((const UA_ObjectTypeNode*)typenode)->isAbstract)
21463  } else {
21465  }
21466 
21467  /* Get the hierarchy of the type and all its supertypes */
21468  UA_NodeId *hierarchy = NULL;
21469  size_t hierarchySize = 0;
21470  UA_StatusCode retval =
21471  getTypeHierarchy(server->nodestore, typenode, true, &hierarchy, &hierarchySize);
21472  if(retval != UA_STATUSCODE_GOOD)
21473  return retval;
21474 
21475  /* Copy members of the type and supertypes */
21476  for(size_t i = 0; i < hierarchySize; ++i)
21477  retval |= copyChildNodesToNode(server, session, &hierarchy[i], nodeId, instantiationCallback);
21478  UA_Array_delete(hierarchy, hierarchySize, &UA_TYPES[UA_TYPES_NODEID]);
21479  if(retval != UA_STATUSCODE_GOOD)
21480  return retval;
21481 
21482  /* Call the object constructor */
21483  if(typenode->nodeClass == UA_NODECLASS_OBJECTTYPE) {
21484  const UA_ObjectLifecycleManagement *olm =
21485  &((const UA_ObjectTypeNode*)typenode)->lifecycleManagement;
21486  if(olm->constructor)
21487  UA_Server_editNode(server, session, nodeId,
21488  (UA_EditNodeCallback)setObjectInstanceHandle,
21489  olm->constructor);
21490  }
21491 
21492  /* Add a hasType reference */
21493  UA_AddReferencesItem addref;
21494  UA_AddReferencesItem_init(&addref);
21495  addref.sourceNodeId = *nodeId;
21496  addref.referenceTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASTYPEDEFINITION);
21497  addref.isForward = true;
21498  addref.targetNodeId.nodeId = *typeId;
21499  return addReference(server, session, &addref);
21500 }
21501 
21502 /* Search for an instance of "browseName" in node searchInstance
21503  * Used during copyChildNodes to find overwritable/mergable nodes */
21504 static UA_StatusCode
21505 instanceFindAggregateByBrowsename(UA_Server *server, UA_Session *session,
21506  const UA_NodeId *searchInstance,
21507  const UA_QualifiedName *browseName,
21508  UA_NodeId *outInstanceNodeId) {
21510  UA_BrowseDescription_init(&bd);
21511  bd.nodeId = *searchInstance;
21512  bd.referenceTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES);
21513  bd.includeSubtypes = true;
21517 
21518  UA_BrowseResult br;
21519  UA_BrowseResult_init(&br);
21520  Service_Browse_single(server, session, NULL, &bd, 0, &br);
21521  if(br.statusCode != UA_STATUSCODE_GOOD)
21522  return br.statusCode;
21523 
21525  for(size_t i = 0; i < br.referencesSize; ++i) {
21526  UA_ReferenceDescription *rd = &br.references[i];
21527  if(rd->browseName.namespaceIndex == browseName->namespaceIndex &&
21528  UA_String_equal(&rd->browseName.name, &browseName->name)) {
21529  retval = UA_NodeId_copy(&rd->nodeId.nodeId, outInstanceNodeId);
21530  break;
21531  }
21532  }
21533 
21534  UA_BrowseResult_deleteMembers(&br);
21535  return retval;
21536 }
21537 
21538 static UA_Boolean
21539 mandatoryChild(UA_Server *server, UA_Session *session, const UA_NodeId *childNodeId) {
21540  const UA_NodeId mandatoryId = UA_NODEID_NUMERIC(0, UA_NS0ID_MODELLINGRULE_MANDATORY);
21541  const UA_NodeId hasModellingRuleId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASMODELLINGRULE);
21542 
21543  /* Get the child */
21544  const UA_Node *child = UA_NodeStore_get(server->nodestore, childNodeId);
21545  if(!child)
21546  return false;
21547 
21548  /* Look for the reference making the child mandatory */
21549  for(size_t i = 0; i < child->referencesSize; ++i) {
21550  UA_ReferenceNode *ref = &child->references[i];
21551  if(!UA_NodeId_equal(&hasModellingRuleId, &ref->referenceTypeId))
21552  continue;
21553  if(!UA_NodeId_equal(&mandatoryId, &ref->targetId.nodeId))
21554  continue;
21555  if(ref->isInverse)
21556  continue;
21557  return true;
21558  }
21559  return false;
21560 }
21561 
21562 /* Copy any children of Node sourceNodeId to another node destinationNodeId
21563  * Used at 2 places:
21564  * (1) During instantiation, when any children of the Type are copied
21565  * (2) During instantiation to copy any *nested* instances to the new node
21566  * (2.1) Might call instantiation of a type first
21567  * (2.2) *Should* then overwrite nested contents in definition --> this scenario is currently not handled!
21568  */
21569 static UA_StatusCode
21570 copyChildNodesToNode(UA_Server* server, UA_Session* session,
21571  const UA_NodeId* sourceNodeId, const UA_NodeId* destinationNodeId,
21572  UA_InstantiationCallback* instantiationCallback) {
21573  /* Browse to get all children */
21575  UA_BrowseDescription_init(&bd);
21576  bd.nodeId = *sourceNodeId;
21577  bd.referenceTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_AGGREGATES);
21578  bd.includeSubtypes = true;
21583 
21584  UA_BrowseResult br;
21585  UA_BrowseResult_init(&br);
21586  Service_Browse_single(server, session, NULL, &bd, 0, &br);
21587  if(br.statusCode != UA_STATUSCODE_GOOD)
21588  return br.statusCode;
21589 
21590  /* Copy all children */
21592  UA_NodeId existingChild = UA_NODEID_NULL;
21593  for(size_t i = 0; i < br.referencesSize; ++i) {
21594  UA_ReferenceDescription *rd = &br.references[i];
21595 
21596  /* Is the child mandatory? If not, skip */
21597  if(!mandatoryChild(server, session, &rd->nodeId.nodeId))
21598  continue;
21599 
21600  /* TODO: If a child is optional, check whether optional children that
21601  * were manually added fit the constraints. */
21602 
21603  /* Check for deduplication */
21604  retval = instanceFindAggregateByBrowsename(server, session, destinationNodeId,
21605  &rd->browseName, &existingChild);
21606  if(retval != UA_STATUSCODE_GOOD)
21607  break;
21608 
21609  if(UA_NodeId_equal(&UA_NODEID_NULL, &existingChild)) {
21610  /* New node in child */
21611  if(rd->nodeClass == UA_NODECLASS_METHOD) {
21612  /* add a reference to the method in the objecttype */
21613  UA_AddReferencesItem newItem;
21614  UA_AddReferencesItem_init(&newItem);
21615  newItem.sourceNodeId = *destinationNodeId;
21616  newItem.referenceTypeId = rd->referenceTypeId;
21617  newItem.isForward = true;
21618  newItem.targetNodeId = rd->nodeId;
21620  retval = addReference(server, session, &newItem);
21621  } else if(rd->nodeClass == UA_NODECLASS_VARIABLE)
21622  retval = copyExistingVariable(server, session, &rd->nodeId.nodeId,
21623  &rd->referenceTypeId, destinationNodeId,
21624  instantiationCallback);
21625  else if(rd->nodeClass == UA_NODECLASS_OBJECT)
21626  retval = copyExistingObject(server, session, &rd->nodeId.nodeId,
21627  &rd->referenceTypeId, destinationNodeId,
21628  instantiationCallback);
21629  } else {
21630  /* Preexistent node in child
21631  * General strategy if we meet an already existing node:
21632  * - Preexistent variable contents always 'win' overwriting anything
21633  * supertypes would instantiate
21634  * - Always copy contents of template *into* existant node (merge
21635  * contents of e.g. Folders like ParameterSet) */
21636  if(rd->nodeClass == UA_NODECLASS_METHOD) {
21637  /* Do nothing, existent method wins */
21638  } else if(rd->nodeClass == UA_NODECLASS_VARIABLE ||
21639  rd->nodeClass == UA_NODECLASS_OBJECT) {
21640  if(!UA_NodeId_equal(&rd->nodeId.nodeId, &existingChild))
21641  retval = copyChildNodesToNode(server, session, &rd->nodeId.nodeId,
21642  &existingChild, instantiationCallback);
21643  }
21644  UA_NodeId_deleteMembers(&existingChild);
21645  }
21646  if(retval != UA_STATUSCODE_GOOD)
21647  break;
21648  }
21649  UA_BrowseResult_deleteMembers(&br);
21650  return retval;
21651 }
21652 
21654 Service_AddNodes_existing(UA_Server *server, UA_Session *session, UA_Node *node,
21655  const UA_NodeId *parentNodeId, const UA_NodeId *referenceTypeId,
21656  const UA_NodeId *typeDefinition,
21657  UA_InstantiationCallback *instantiationCallback,
21658  UA_NodeId *addedNodeId) {
21660 
21661  /* Check the namespaceindex */
21662  if(node->nodeId.namespaceIndex >= server->namespacesSize) {
21663  UA_LOG_INFO_SESSION(server->config.logger, session, "AddNodes: Namespace invalid");
21666  }
21667 
21668  /* Check the reference to the parent */
21669  UA_StatusCode retval = checkParentReference(server, session, node->nodeClass,
21670  parentNodeId, referenceTypeId);
21671  if(retval != UA_STATUSCODE_GOOD) {
21672  UA_LOG_INFO_SESSION(server->config.logger, session,
21673  "AddNodes: Checking the reference to the parent returned "
21674  "error code %s", UA_StatusCode_name(retval));
21676  return retval;
21677  }
21678 
21679  /* Add the node to the nodestore */
21680  retval = UA_NodeStore_insert(server->nodestore, node);
21681  if(retval != UA_STATUSCODE_GOOD) {
21682  UA_LOG_INFO_SESSION(server->config.logger, session,
21683  "AddNodes: Node could not be added to the nodestore "
21684  "with error code %s", UA_StatusCode_name(retval));
21685  return retval;
21686  }
21687 
21688  /* Copy the nodeid if needed */
21689  if(addedNodeId) {
21690  retval = UA_NodeId_copy(&node->nodeId, addedNodeId);
21691  if(retval != UA_STATUSCODE_GOOD) {
21692  UA_LOG_INFO_SESSION(server->config.logger, session,
21693  "AddNodes: Could not copy the nodeid");
21694  goto remove_node;
21695  }
21696  }
21697 
21698  /* Hierarchical reference back to the parent */
21699  if(!UA_NodeId_isNull(parentNodeId)) {
21700  UA_AddReferencesItem item;
21701  UA_AddReferencesItem_init(&item);
21702  item.sourceNodeId = node->nodeId;
21703  item.referenceTypeId = *referenceTypeId;
21704  item.isForward = false;
21705  item.targetNodeId.nodeId = *parentNodeId;
21706  retval = addReference(server, session, &item);
21707  if(retval != UA_STATUSCODE_GOOD) {
21708  UA_LOG_INFO_SESSION(server->config.logger, session,
21709  "AddNodes: Could not add the reference to the parent"
21710  "with error code %s", UA_StatusCode_name(retval));
21711  goto remove_node;
21712  }
21713  }
21714 
21715  /* Fall back to a default typedefinition for variables and objects */
21716  const UA_NodeId basedatavariabletype = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE);
21717  const UA_NodeId baseobjecttype = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE);
21718  if(node->nodeClass == UA_NODECLASS_VARIABLE ||
21719  node->nodeClass == UA_NODECLASS_OBJECT) {
21720  if(!typeDefinition || UA_NodeId_isNull(typeDefinition)) {
21721  if(node->nodeClass == UA_NODECLASS_VARIABLE)
21722  typeDefinition = &basedatavariabletype;
21723  else
21724  typeDefinition = &baseobjecttype;
21725  }
21726 
21727  /* Instantiate variables and objects */
21728  retval = instantiateNode(server, session, &node->nodeId, node->nodeClass,
21729  typeDefinition, instantiationCallback);
21730  if(retval != UA_STATUSCODE_GOOD) {
21731  UA_LOG_INFO_SESSION(server->config.logger, session,
21732  "AddNodes: Could not instantiate the node with"
21733  "error code %s", UA_StatusCode_name(retval));
21734  goto remove_node;
21735  }
21736  }
21737 
21738  /* Custom callback */
21739  if(instantiationCallback)
21740  instantiationCallback->method(node->nodeId, *typeDefinition,
21741  instantiationCallback->handle);
21742  return UA_STATUSCODE_GOOD;
21743 
21744  remove_node:
21745  deleteNode(server, &adminSession, &node->nodeId, true);
21746  return retval;
21747 }
21748 
21749 /*******************************************/
21750 /* Create nodes from attribute description */
21751 /*******************************************/
21752 
21753 static UA_StatusCode
21754 copyStandardAttributes(UA_Node *node, const UA_AddNodesItem *item,
21755  const UA_NodeAttributes *attr) {
21756  UA_StatusCode retval;
21757  retval = UA_NodeId_copy(&item->requestedNewNodeId.nodeId, &node->nodeId);
21758  retval |= UA_QualifiedName_copy(&item->browseName, &node->browseName);
21759  retval |= UA_LocalizedText_copy(&attr->displayName, &node->displayName);
21760  retval |= UA_LocalizedText_copy(&attr->description, &node->description);
21761  node->writeMask = attr->writeMask;
21762  node->userWriteMask = attr->userWriteMask;
21763  return retval;
21764 }
21765 
21766 static UA_StatusCode
21767 copyCommonVariableAttributes(UA_Server *server, UA_VariableNode *node,
21768  const UA_AddNodesItem *item,
21769  const UA_VariableAttributes *attr) {
21770  const UA_NodeId basevartype = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEVARIABLETYPE);
21771  const UA_NodeId basedatavartype = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE);
21772  const UA_NodeId *typeDef = &item->typeDefinition.nodeId;
21773  if(UA_NodeId_isNull(typeDef)) /* workaround when the variabletype is undefined */
21774  typeDef = &basedatavartype;
21775 
21776  /* Make sure we can instantiate the basetypes themselves */
21778  if(UA_NodeId_equal(&node->nodeId, &basevartype) ||
21779  UA_NodeId_equal(&node->nodeId, &basedatavartype)) {
21780  node->dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATATYPE);
21781  node->valueRank = -2;
21782  return retval;
21783  }
21784 
21785  const UA_VariableTypeNode *vt =
21786  (const UA_VariableTypeNode*)UA_NodeStore_get(server->nodestore, typeDef);
21787  if(!vt || vt->nodeClass != UA_NODECLASS_VARIABLETYPE)
21789  if(node->nodeClass == UA_NODECLASS_VARIABLE && vt->isAbstract)
21791 
21792  /* Set the datatype */
21793  if(!UA_NodeId_isNull(&attr->dataType))
21794  retval = writeDataTypeAttribute(server, node, &attr->dataType, &vt->dataType);
21795  else /* workaround common error where the datatype is left as NA_NODEID_NULL */
21796  retval = UA_NodeId_copy(&vt->dataType, &node->dataType);
21797  if(retval != UA_STATUSCODE_GOOD)
21798  return retval;
21799 
21800  /* Set the array dimensions. Check only against the vt. */
21801  retval = compatibleArrayDimensions(vt->arrayDimensionsSize, vt->arrayDimensions,
21802  attr->arrayDimensionsSize, attr->arrayDimensions);
21803  if(retval == UA_STATUSCODE_GOOD) {
21804  retval = UA_Array_copy(attr->arrayDimensions, attr->arrayDimensionsSize,
21805  (void**)&node->arrayDimensions, &UA_TYPES[UA_TYPES_UINT32]);
21806  }
21807  if(retval != UA_STATUSCODE_GOOD) {
21808  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
21809  "Array dimensions incompatible with the VariableType "
21810  "with error code %s", UA_StatusCode_name(retval));
21811  return retval;
21812  }
21813  node->arrayDimensionsSize = attr->arrayDimensionsSize;
21814 
21815  /* Set the valuerank */
21816  if(attr->valueRank != 0 || !UA_Variant_isScalar(&attr->value))
21817  retval = writeValueRankAttribute(server, node, attr->valueRank, vt->valueRank);
21818  else /* workaround common error where the valuerank is left as 0 */
21819  node->valueRank = vt->valueRank;
21820  if(retval != UA_STATUSCODE_GOOD) {
21821  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
21822  "Value Rank incompatible with the VariableType "
21823  "with error code %s", UA_StatusCode_name(retval));
21824  return retval;
21825  }
21826 
21827  /* Set the value */
21828  UA_DataValue value;
21829  UA_DataValue_init(&value);
21830  value.hasValue = true;
21831  value.value = attr->value;
21833 
21834  /* Use the default value from the vt if none is defined */
21835  if(!value.value.type) {
21836  retval = readValueAttribute(server, (const UA_VariableNode*)vt, &value);
21837  if(retval != UA_STATUSCODE_GOOD) {
21838  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
21839  "Could not read the value of the variable type "
21840  "with error code %s", UA_StatusCode_name(retval));
21841  return retval;
21842  }
21843  }
21844 
21845  /* Write the value to the node */
21846  retval = writeValueAttribute(server, node, &value, NULL);
21847  if(retval != UA_STATUSCODE_GOOD) {
21848  UA_LOG_INFO(server->config.logger, UA_LOGCATEGORY_SERVER,
21849  "Could not set the value of the new node "
21850  "with error code %s", UA_StatusCode_name(retval));
21851  }
21852  UA_DataValue_deleteMembers(&value);
21853  return retval;
21854 }
21855 
21856 static UA_StatusCode
21857 copyVariableNodeAttributes(UA_Server *server, UA_VariableNode *vnode,
21858  const UA_AddNodesItem *item,
21859  const UA_VariableAttributes *attr) {
21860  vnode->accessLevel = attr->accessLevel;
21861  vnode->userAccessLevel = attr->userAccessLevel;
21862  vnode->historizing = attr->historizing;
21864  return copyCommonVariableAttributes(server, vnode, item, attr);
21865 }
21866 
21867 static UA_StatusCode
21868 copyVariableTypeNodeAttributes(UA_Server *server, UA_VariableTypeNode *vtnode,
21869  const UA_AddNodesItem *item,
21870  const UA_VariableTypeAttributes *attr) {
21871  vtnode->isAbstract = attr->isAbstract;
21872  return copyCommonVariableAttributes(server, (UA_VariableNode*)vtnode, item,
21873  (const UA_VariableAttributes*)attr);
21874 }
21875 
21876 static UA_StatusCode
21877 copyObjectNodeAttributes(UA_ObjectNode *onode, const UA_ObjectAttributes *attr) {
21878  onode->eventNotifier = attr->eventNotifier;
21879  return UA_STATUSCODE_GOOD;
21880 }
21881 
21882 static UA_StatusCode
21883 copyReferenceTypeNodeAttributes(UA_ReferenceTypeNode *rtnode,
21884  const UA_ReferenceTypeAttributes *attr) {
21885  rtnode->isAbstract = attr->isAbstract;
21886  rtnode->symmetric = attr->symmetric;
21887  return UA_LocalizedText_copy(&attr->inverseName, &rtnode->inverseName);
21888 }
21889 
21890 static UA_StatusCode
21891 copyObjectTypeNodeAttributes(UA_ObjectTypeNode *otnode,
21892  const UA_ObjectTypeAttributes *attr) {
21893  otnode->isAbstract = attr->isAbstract;
21894  return UA_STATUSCODE_GOOD;
21895 }
21896 
21897 static UA_StatusCode
21898 copyViewNodeAttributes(UA_ViewNode *vnode, const UA_ViewAttributes *attr) {
21899  vnode->containsNoLoops = attr->containsNoLoops;
21900  vnode->eventNotifier = attr->eventNotifier;
21901  return UA_STATUSCODE_GOOD;
21902 }
21903 
21904 static UA_StatusCode
21905 copyDataTypeNodeAttributes(UA_DataTypeNode *dtnode,
21906  const UA_DataTypeAttributes *attr) {
21907  dtnode->isAbstract = attr->isAbstract;
21908  return UA_STATUSCODE_GOOD;
21909 }
21910 
21911 #define CHECK_ATTRIBUTES(TYPE) \
21912  if(item->nodeAttributes.content.decoded.type != &UA_TYPES[UA_TYPES_##TYPE]) { \
21913  retval = UA_STATUSCODE_BADNODEATTRIBUTESINVALID; \
21914  break; \
21915  }
21916 
21917 static UA_StatusCode
21918 createNodeFromAttributes(UA_Server *server, const UA_AddNodesItem *item, UA_Node **newNode) {
21919  /* Check that we can read the attributes */
21921  !item->nodeAttributes.content.decoded.type)
21923 
21924  /* Create the node */
21925  // todo: error case where the nodeclass is faulty
21926  void *node = UA_NodeStore_newNode(item->nodeClass);
21927  if(!node)
21929 
21930  /* Copy the attributes into the node */
21931  void *data = item->nodeAttributes.content.decoded.data;
21932  UA_StatusCode retval = copyStandardAttributes(node, item, data);
21933  switch(item->nodeClass) {
21934  case UA_NODECLASS_OBJECT:
21935  CHECK_ATTRIBUTES(OBJECTATTRIBUTES);
21936  retval |= copyObjectNodeAttributes(node, data);
21937  break;
21938  case UA_NODECLASS_VARIABLE:
21939  CHECK_ATTRIBUTES(VARIABLEATTRIBUTES);
21940  retval |= copyVariableNodeAttributes(server, node, item, data);
21941  break;
21943  CHECK_ATTRIBUTES(OBJECTTYPEATTRIBUTES);
21944  retval |= copyObjectTypeNodeAttributes(node, data);
21945  break;
21947  CHECK_ATTRIBUTES(VARIABLETYPEATTRIBUTES);
21948  retval |= copyVariableTypeNodeAttributes(server, node, item, data);
21949  break;
21951  CHECK_ATTRIBUTES(REFERENCETYPEATTRIBUTES);
21952  retval |= copyReferenceTypeNodeAttributes(node, data);
21953  break;
21954  case UA_NODECLASS_DATATYPE:
21955  CHECK_ATTRIBUTES(DATATYPEATTRIBUTES);
21956  retval |= copyDataTypeNodeAttributes(node, data);
21957  break;
21958  case UA_NODECLASS_VIEW:
21959  CHECK_ATTRIBUTES(VIEWATTRIBUTES);
21960  retval |= copyViewNodeAttributes(node, data);
21961  break;
21962  case UA_NODECLASS_METHOD:
21964  default:
21966  }
21967 
21968  if(retval == UA_STATUSCODE_GOOD)
21969  *newNode = node;
21970  else
21972  return retval;
21973 }
21974 
21975 static void
21976 Service_AddNodes_single(UA_Server *server, UA_Session *session,
21977  const UA_AddNodesItem *item, UA_AddNodesResult *result,
21978  UA_InstantiationCallback *instantiationCallback) {
21979  /* Create the node from the attributes*/
21980  UA_Node *node = NULL;
21981  result->statusCode = createNodeFromAttributes(server, item, &node);
21982  if(result->statusCode != UA_STATUSCODE_GOOD) {
21983  UA_LOG_INFO_SESSION(server->config.logger, session,
21984  "Could not add node with error code %s",
21985  UA_StatusCode_name(result->statusCode));
21986  return;
21987  }
21988 
21989  /* Run consistency checks and add the node */
21990  UA_assert(node != NULL);
21991  result->statusCode = Service_AddNodes_existing(server, session, node, &item->parentNodeId.nodeId,
21992  &item->referenceTypeId, &item->typeDefinition.nodeId,
21993  instantiationCallback, &result->addedNodeId);
21994  if(result->statusCode != UA_STATUSCODE_GOOD) {
21995  UA_LOG_INFO_SESSION(server->config.logger, session,
21996  "Could not add node with error code %s",
21997  UA_StatusCode_name(result->statusCode));
21998  }
21999 }
22000 
22001 void Service_AddNodes(UA_Server *server, UA_Session *session,
22002  const UA_AddNodesRequest *request,
22003  UA_AddNodesResponse *response) {
22004  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing AddNodesRequest");
22005  if(request->nodesToAddSize <= 0) {
22007  return;
22008  }
22009  size_t size = request->nodesToAddSize;
22010 
22012  if(!response->results) {
22014  return;
22015  }
22016 
22017 
22018  response->resultsSize = size;
22019  for(size_t i = 0; i < size; ++i) {
22020  Service_AddNodes_single(server, session, &request->nodesToAdd[i],
22021  &response->results[i], NULL);
22022  }
22023 }
22024 
22026 __UA_Server_addNode(UA_Server *server, const UA_NodeClass nodeClass,
22027  const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId,
22028  const UA_NodeId referenceTypeId, const UA_QualifiedName browseName,
22029  const UA_NodeId typeDefinition, const UA_NodeAttributes *attr,
22030  const UA_DataType *attributeType,
22031  UA_InstantiationCallback *instantiationCallback, UA_NodeId *outNewNodeId) {
22032  /* prepare the item */
22033  UA_AddNodesItem item;
22034  UA_AddNodesItem_init(&item);
22035  item.parentNodeId.nodeId = parentNodeId;
22036  item.referenceTypeId = referenceTypeId;
22037  item.requestedNewNodeId.nodeId = requestedNewNodeId;
22038  item.browseName = browseName;
22039  item.nodeClass = nodeClass;
22040  item.typeDefinition.nodeId = typeDefinition;
22043  .content.decoded = {attributeType, (void*)(uintptr_t)attr}};
22044 
22045  /* run the service */
22046  UA_AddNodesResult result;
22047  UA_AddNodesResult_init(&result);
22048  UA_RCU_LOCK();
22049  Service_AddNodes_single(server, &adminSession, &item, &result, instantiationCallback);
22050  UA_RCU_UNLOCK();
22051 
22052  /* prepare the output */
22053  if(outNewNodeId && result.statusCode == UA_STATUSCODE_GOOD)
22054  *outNewNodeId = result.addedNodeId;
22055  else
22056  UA_NodeId_deleteMembers(&result.addedNodeId);
22057  return result.statusCode;
22058 }
22059 
22060 /**************************************************/
22061 /* Add Special Nodes (not possible over the wire) */
22062 /**************************************************/
22063 
22065 UA_Server_addDataSourceVariableNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
22066  const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
22067  const UA_QualifiedName browseName, const UA_NodeId typeDefinition,
22068  const UA_VariableAttributes attr, const UA_DataSource dataSource,
22069  UA_NodeId *outNewNodeId) {
22070  /* Create the new node */
22072  if(!node)
22074 
22075  /* Read the current value (to do typechecking) */
22077  UA_VariableAttributes editAttr = attr;
22078  UA_DataValue value;
22079  UA_DataValue_init(&value);
22080  if(dataSource.read)
22081  retval = dataSource.read(dataSource.handle, requestedNewNodeId,
22082  false, NULL, &value);
22083  else
22085  editAttr.value = value.value;
22086 
22087  if(retval != UA_STATUSCODE_GOOD) {
22088  UA_NodeStore_deleteNode((UA_Node*)node);
22089  return retval;
22090  }
22091 
22092  /* Copy attributes into node */
22093  UA_RCU_LOCK();
22094  UA_AddNodesItem item;
22095  UA_AddNodesItem_init(&item);
22096  item.requestedNewNodeId.nodeId = requestedNewNodeId;
22097  item.browseName = browseName;
22098  item.typeDefinition.nodeId = typeDefinition;
22099  item.parentNodeId.nodeId = parentNodeId;
22100  retval |= copyStandardAttributes((UA_Node*)node, &item, (const UA_NodeAttributes*)&editAttr);
22101  retval |= copyVariableNodeAttributes(server, node, &item, &editAttr);
22102  UA_DataValue_deleteMembers(&node->value.data.value);
22103  node->valueSource = UA_VALUESOURCE_DATASOURCE;
22104  node->value.dataSource = dataSource;
22105  UA_DataValue_deleteMembers(&value);
22106  if(retval != UA_STATUSCODE_GOOD) {
22107  UA_NodeStore_deleteNode((UA_Node*)node);
22108  UA_RCU_UNLOCK();
22109  return retval;
22110  }
22111 
22112  /* Add the node */
22113  UA_AddNodesResult result;
22114  UA_AddNodesResult_init(&result);
22115  retval = Service_AddNodes_existing(server, &adminSession, (UA_Node*)node, &parentNodeId,
22116  &referenceTypeId, &typeDefinition, NULL, outNewNodeId);
22117  UA_RCU_UNLOCK();
22118  return retval;
22119 }
22120 
22121 #ifdef UA_ENABLE_METHODCALLS
22122 
22124 UA_Server_addMethodNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
22125  const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
22126  const UA_QualifiedName browseName, const UA_MethodAttributes attr,
22127  UA_MethodCallback method, void *handle,
22128  size_t inputArgumentsSize, const UA_Argument* inputArguments,
22129  size_t outputArgumentsSize, const UA_Argument* outputArguments,
22130  UA_NodeId *outNewNodeId) {
22132  if(!node)
22134 
22135  UA_AddNodesItem item;
22136  UA_AddNodesItem_init(&item);
22137  item.requestedNewNodeId.nodeId = requestedNewNodeId;
22138  item.browseName = browseName;
22139  copyStandardAttributes((UA_Node*)node, &item, (const UA_NodeAttributes*)&attr);
22140  node->executable = attr.executable;
22141  node->userExecutable = attr.userExecutable;
22142  node->attachedMethod = method;
22143  node->methodHandle = handle;
22144 
22145  /* Add the node */
22146  UA_NodeId newMethodId;
22147  UA_NodeId_init(&newMethodId);
22148  UA_RCU_LOCK();
22149  UA_StatusCode retval = Service_AddNodes_existing(server, &adminSession, (UA_Node*)node, &parentNodeId,
22150  &referenceTypeId, &UA_NODEID_NULL, NULL, &newMethodId);
22151  UA_RCU_UNLOCK();
22152  if(retval != UA_STATUSCODE_GOOD)
22153  return retval;
22154 
22155  const UA_NodeId hasproperty = UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY);
22156  const UA_NodeId propertytype = UA_NODEID_NUMERIC(0, UA_NS0ID_PROPERTYTYPE);
22157 
22158  if(inputArgumentsSize > 0) {
22159  UA_VariableNode *inputArgumentsVariableNode = UA_NodeStore_newVariableNode();
22160  inputArgumentsVariableNode->nodeId.namespaceIndex = newMethodId.namespaceIndex;
22161  inputArgumentsVariableNode->browseName = UA_QUALIFIEDNAME_ALLOC(0, "InputArguments");
22162  inputArgumentsVariableNode->displayName = UA_LOCALIZEDTEXT_ALLOC("en_US", "InputArguments");
22163  inputArgumentsVariableNode->description = UA_LOCALIZEDTEXT_ALLOC("en_US", "InputArguments");
22164  inputArgumentsVariableNode->valueRank = 1;
22165 
22166  /* UAExpert creates a monitoreditem on inputarguments ... */
22167  inputArgumentsVariableNode->minimumSamplingInterval = 10000.0f;
22168 
22169  //TODO: 0.3 work item: the addMethodNode API does not have the possibility to set nodeIDs
22170  //actually we need to change the signature to pass UA_NS0ID_SERVER_GETMONITOREDITEMS_INPUTARGUMENTS
22171  //and UA_NS0ID_SERVER_GETMONITOREDITEMS_OUTPUTARGUMENTS into the function :/
22172  if(newMethodId.namespaceIndex == 0 &&
22173  newMethodId.identifierType == UA_NODEIDTYPE_NUMERIC &&
22175  inputArgumentsVariableNode->nodeId =
22177  }
22178  UA_Variant_setArrayCopy(&inputArgumentsVariableNode->value.data.value.value,
22179  inputArguments, inputArgumentsSize,
22181  inputArgumentsVariableNode->value.data.value.hasValue = true;
22182  UA_RCU_LOCK();
22183  // todo: check if adding succeeded
22184  Service_AddNodes_existing(server, &adminSession, (UA_Node*)inputArgumentsVariableNode,
22185  &newMethodId, &hasproperty, &propertytype, NULL, NULL);
22186  UA_RCU_UNLOCK();
22187  }
22188 
22189  if(outputArgumentsSize > 0) {
22190  /* create OutputArguments */
22191  UA_VariableNode *outputArgumentsVariableNode = UA_NodeStore_newVariableNode();
22192  outputArgumentsVariableNode->nodeId.namespaceIndex = newMethodId.namespaceIndex;
22193  outputArgumentsVariableNode->browseName = UA_QUALIFIEDNAME_ALLOC(0, "OutputArguments");
22194  outputArgumentsVariableNode->displayName = UA_LOCALIZEDTEXT_ALLOC("en_US", "OutputArguments");
22195  outputArgumentsVariableNode->description = UA_LOCALIZEDTEXT_ALLOC("en_US", "OutputArguments");
22196  outputArgumentsVariableNode->valueRank = 1;
22197  //FIXME: comment in line 882
22198  if(newMethodId.namespaceIndex == 0 &&
22199  newMethodId.identifierType == UA_NODEIDTYPE_NUMERIC &&
22201  outputArgumentsVariableNode->nodeId =
22203  }
22204  UA_Variant_setArrayCopy(&outputArgumentsVariableNode->value.data.value.value,
22205  outputArguments, outputArgumentsSize,
22207  outputArgumentsVariableNode->value.data.value.hasValue = true;
22208  UA_RCU_LOCK();
22209  // todo: check if adding succeeded
22210  Service_AddNodes_existing(server, &adminSession, (UA_Node*)outputArgumentsVariableNode,
22211  &newMethodId, &hasproperty, &propertytype, NULL, NULL);
22212  UA_RCU_UNLOCK();
22213  }
22214 
22215  if(outNewNodeId)
22216  *outNewNodeId = newMethodId;
22217  else
22218  UA_NodeId_deleteMembers(&newMethodId);
22219  return retval;
22220 }
22221 
22222 #endif
22223 
22224 /******************/
22225 /* Add References */
22226 /******************/
22227 
22228 static UA_StatusCode
22229 deleteOneWayReference(UA_Server *server, UA_Session *session, UA_Node *node,
22230  const UA_DeleteReferencesItem *item);
22231 
22232 /* Adds a one-way reference to the local nodestore */
22233 static UA_StatusCode
22234 addOneWayReference(UA_Server *server, UA_Session *session,
22235  UA_Node *node, const UA_AddReferencesItem *item) {
22236  size_t i = node->referencesSize;
22237  size_t refssize = (i+1) | 3; // so the realloc is not necessary every time
22238  UA_ReferenceNode *new_refs = UA_realloc(node->references, sizeof(UA_ReferenceNode) * refssize);
22239  if(!new_refs)
22241  node->references = new_refs;
22242  UA_ReferenceNode_init(&new_refs[i]);
22243  UA_StatusCode retval = UA_NodeId_copy(&item->referenceTypeId, &new_refs[i].referenceTypeId);
22244  retval |= UA_ExpandedNodeId_copy(&item->targetNodeId, &new_refs[i].targetId);
22245  new_refs[i].isInverse = !item->isForward;
22246  if(retval == UA_STATUSCODE_GOOD)
22247  node->referencesSize = i+1;
22248  else
22249  UA_ReferenceNode_deleteMembers(&new_refs[i]);
22250  return retval;
22251 }
22252 
22253 static UA_StatusCode
22254 addReference(UA_Server *server, UA_Session *session,
22255  const UA_AddReferencesItem *item) {
22256  /* Currently no expandednodeids are allowed */
22257  if(item->targetServerUri.length > 0)
22259 
22260  /* Add the first direction */
22261  UA_StatusCode retval = UA_Server_editNode(server, session, &item->sourceNodeId,
22262  (UA_EditNodeCallback)addOneWayReference,
22263  item);
22264 
22265 
22266  if(retval != UA_STATUSCODE_GOOD)
22267  return retval;
22268 
22269  /* Add the second direction */
22270  UA_AddReferencesItem secondItem;
22271  UA_AddReferencesItem_init(&secondItem);
22272  secondItem.sourceNodeId = item->targetNodeId.nodeId;
22273  secondItem.referenceTypeId = item->referenceTypeId;
22274  secondItem.isForward = !item->isForward;
22275  secondItem.targetNodeId.nodeId = item->sourceNodeId;
22276  /* keep default secondItem.targetNodeClass = UA_NODECLASS_UNSPECIFIED */
22277 
22278  retval = UA_Server_editNode(server, session, &secondItem.sourceNodeId,
22279  (UA_EditNodeCallback)addOneWayReference, &secondItem);
22280 
22281  /* remove reference if the second direction failed */
22282  if(retval != UA_STATUSCODE_GOOD) {
22283  UA_DeleteReferencesItem deleteItem;
22284  deleteItem.sourceNodeId = item->sourceNodeId;
22285  deleteItem.referenceTypeId = item->referenceTypeId;
22286  deleteItem.isForward = item->isForward;
22287  deleteItem.targetNodeId = item->targetNodeId;
22288  deleteItem.deleteBidirectional = false;
22289  /* ignore returned status code */
22290  UA_Server_editNode(server, session, &item->sourceNodeId,
22291  (UA_EditNodeCallback)deleteOneWayReference, &deleteItem);
22292  }
22293  return retval;
22294 }
22295 
22296 void Service_AddReferences(UA_Server *server, UA_Session *session,
22297  const UA_AddReferencesRequest *request,
22298  UA_AddReferencesResponse *response) {
22299  UA_LOG_DEBUG_SESSION(server->config.logger, session,
22300  "Processing AddReferencesRequest");
22301  if(request->referencesToAddSize <= 0) {
22303  return;
22304  }
22305 
22306  response->results = UA_malloc(sizeof(UA_StatusCode) * request->referencesToAddSize);
22307  if(!response->results) {
22309  return;
22310  }
22311  response->resultsSize = request->referencesToAddSize;
22312 
22313  for(size_t i = 0; i < response->resultsSize; ++i)
22314  response->results[i] =
22315  addReference(server, session, &request->referencesToAdd[i]);
22316 }
22317 
22319 UA_Server_addReference(UA_Server *server, const UA_NodeId sourceId,
22320  const UA_NodeId refTypeId, const UA_ExpandedNodeId targetId,
22321  UA_Boolean isForward) {
22322  UA_AddReferencesItem item;
22323  UA_AddReferencesItem_init(&item);
22324  item.sourceNodeId = sourceId;
22325  item.referenceTypeId = refTypeId;
22326  item.isForward = isForward;
22327  item.targetNodeId = targetId;
22328  UA_RCU_LOCK();
22329  UA_StatusCode retval = addReference(server, &adminSession, &item);
22330  UA_RCU_UNLOCK();
22331  return retval;
22332 }
22333 
22334 /****************/
22335 /* Delete Nodes */
22336 /****************/
22337 
22338 static void
22339 removeReferences(UA_Server *server, UA_Session *session, const UA_Node *node) {
22341  UA_DeleteReferencesItem_init(&item);
22342  item.targetNodeId.nodeId = node->nodeId;
22343  for(size_t i = 0; i < node->referencesSize; ++i) {
22344  item.isForward = node->references[i].isInverse;
22345  item.sourceNodeId = node->references[i].targetId.nodeId;
22346  item.referenceTypeId = node->references[i].referenceTypeId;
22347  deleteReference(server, session, &item);
22348  }
22349 }
22350 
22351 static UA_StatusCode
22352 deleteNode(UA_Server *server, UA_Session *session,
22353  const UA_NodeId *nodeId, UA_Boolean deleteReferences) {
22354  const UA_Node *node = UA_NodeStore_get(server->nodestore, nodeId);
22355  if(!node)
22357 
22358  /* TODO: check if the information model consistency is violated */
22359  /* TODO: Check if the node is a mandatory child of an object */
22360 
22361  /* Destroy an object before removing it */
22362  if(node->nodeClass == UA_NODECLASS_OBJECT) {
22363  /* Call the destructor from the object type */
22364  const UA_ObjectTypeNode *typenode = getObjectNodeType(server, (const UA_ObjectNode*)node);
22365  if(typenode && typenode->lifecycleManagement.destructor)
22366  typenode->lifecycleManagement.destructor(*nodeId, ((const UA_ObjectNode*)node)->instanceHandle);
22367  }
22368 
22369  /* Remove references to the node (not the references in the node that will
22370  * be deleted anyway) */
22371  if(deleteReferences)
22372  removeReferences(server, session, node);
22373 
22374  return UA_NodeStore_remove(server->nodestore, nodeId);
22375 }
22376 
22377 void Service_DeleteNodes(UA_Server *server, UA_Session *session,
22378  const UA_DeleteNodesRequest *request,
22379  UA_DeleteNodesResponse *response) {
22380  UA_LOG_DEBUG_SESSION(server->config.logger, session,
22381  "Processing DeleteNodesRequest");
22382  if(request->nodesToDeleteSize == 0) {
22384  return;
22385  }
22386 
22387  response->results = UA_malloc(sizeof(UA_StatusCode) * request->nodesToDeleteSize);
22388  if(!response->results) {
22390  return;
22391  }
22392  response->resultsSize = request->nodesToDeleteSize;
22393 
22394  for(size_t i = 0; i < request->nodesToDeleteSize; ++i) {
22395  UA_DeleteNodesItem *item = &request->nodesToDelete[i];
22396  response->results[i] = deleteNode(server, session, &item->nodeId,
22397  item->deleteTargetReferences);
22398  }
22399 }
22400 
22402 UA_Server_deleteNode(UA_Server *server, const UA_NodeId nodeId,
22403  UA_Boolean deleteReferences) {
22404  UA_RCU_LOCK();
22405  UA_StatusCode retval = deleteNode(server, &adminSession,
22406  &nodeId, deleteReferences);
22407  UA_RCU_UNLOCK();
22408  return retval;
22409 }
22410 
22411 /*********************/
22412 /* Delete References */
22413 /*********************/
22414 
22415 // TODO: Check consistency constraints, remove the references.
22416 static UA_StatusCode
22417 deleteOneWayReference(UA_Server *server, UA_Session *session, UA_Node *node,
22418  const UA_DeleteReferencesItem *item) {
22419  UA_Boolean edited = false;
22420  for(size_t i = node->referencesSize; i > 0; --i) {
22421  UA_ReferenceNode *ref = &node->references[i-1];
22422  if(!UA_NodeId_equal(&item->targetNodeId.nodeId, &ref->targetId.nodeId))
22423  continue;
22424  if(!UA_NodeId_equal(&item->referenceTypeId, &ref->referenceTypeId))
22425  continue;
22426  if(item->isForward == ref->isInverse)
22427  continue;
22428  UA_ReferenceNode_deleteMembers(ref);
22429  /* move the last entry to override the current position */
22430  node->references[i-1] = node->references[node->referencesSize-1];
22431  --node->referencesSize;
22432  edited = true;
22433  break;
22434  }
22435  if(!edited)
22437  /* we removed the last reference */
22438  if(node->referencesSize == 0 && node->references) {
22439  UA_free(node->references);
22440  node->references = NULL;
22441  }
22442  return UA_STATUSCODE_GOOD;;
22443 }
22444 
22445 static UA_StatusCode
22446 deleteReference(UA_Server *server, UA_Session *session,
22447  const UA_DeleteReferencesItem *item) {
22448  UA_StatusCode retval = UA_Server_editNode(server, session, &item->sourceNodeId,
22449  (UA_EditNodeCallback)deleteOneWayReference, item);
22450  if(retval != UA_STATUSCODE_GOOD)
22451  return retval;
22452  if(!item->deleteBidirectional || item->targetNodeId.serverIndex != 0)
22453  return retval;
22454  UA_DeleteReferencesItem secondItem;
22455  UA_DeleteReferencesItem_init(&secondItem);
22456  secondItem.isForward = !item->isForward;
22457  secondItem.sourceNodeId = item->targetNodeId.nodeId;
22458  secondItem.targetNodeId.nodeId = item->sourceNodeId;
22459  secondItem.referenceTypeId = item->referenceTypeId;
22460  return UA_Server_editNode(server, session, &secondItem.sourceNodeId,
22461  (UA_EditNodeCallback)deleteOneWayReference, &secondItem);
22462 }
22463 
22464 void
22465 Service_DeleteReferences(UA_Server *server, UA_Session *session,
22466  const UA_DeleteReferencesRequest *request,
22467  UA_DeleteReferencesResponse *response) {
22468  UA_LOG_DEBUG_SESSION(server->config.logger, session,
22469  "Processing DeleteReferencesRequest");
22470  if(request->referencesToDeleteSize <= 0) {
22472  return;
22473  }
22474 
22475  response->results = UA_malloc(sizeof(UA_StatusCode) * request->referencesToDeleteSize);
22476  if(!response->results) {
22478  return;
22479  }
22480  response->resultsSize = request->referencesToDeleteSize;
22481 
22482  for(size_t i = 0; i < request->referencesToDeleteSize; ++i)
22483  response->results[i] =
22484  deleteReference(server, session, &request->referencesToDelete[i]);
22485 }
22486 
22488 UA_Server_deleteReference(UA_Server *server, const UA_NodeId sourceNodeId,
22489  const UA_NodeId referenceTypeId,
22490  UA_Boolean isForward, const UA_ExpandedNodeId targetNodeId,
22491  UA_Boolean deleteBidirectional) {
22493  item.sourceNodeId = sourceNodeId;
22494  item.referenceTypeId = referenceTypeId;
22495  item.isForward = isForward;
22496  item.targetNodeId = targetNodeId;
22497  item.deleteBidirectional = deleteBidirectional;
22498  UA_RCU_LOCK();
22499  UA_StatusCode retval = deleteReference(server, &adminSession, &item);
22500  UA_RCU_UNLOCK();
22501  return retval;
22502 }
22503 
22504 /**********************/
22505 /* Set Value Callback */
22506 /**********************/
22507 
22508 static UA_StatusCode
22509 setValueCallback(UA_Server *server, UA_Session *session,
22510  UA_VariableNode *node, UA_ValueCallback *callback) {
22511  if(node->nodeClass != UA_NODECLASS_VARIABLE)
22513  node->value.data.callback = *callback;
22514  return UA_STATUSCODE_GOOD;
22515 }
22516 
22518 UA_Server_setVariableNode_valueCallback(UA_Server *server, const UA_NodeId nodeId,
22519  const UA_ValueCallback callback) {
22520  UA_RCU_LOCK();
22521  UA_StatusCode retval = UA_Server_editNode(server, &adminSession, &nodeId,
22522  (UA_EditNodeCallback)setValueCallback, &callback);
22523  UA_RCU_UNLOCK();
22524  return retval;
22525 }
22526 
22527 /******************/
22528 /* Set DataSource */
22529 /******************/
22530 
22531 static UA_StatusCode
22532 setDataSource(UA_Server *server, UA_Session *session,
22533  UA_VariableNode* node, UA_DataSource *dataSource) {
22534  if(node->nodeClass != UA_NODECLASS_VARIABLE)
22536  if(node->valueSource == UA_VALUESOURCE_DATA)
22537  UA_DataValue_deleteMembers(&node->value.data.value);
22538  node->value.dataSource = *dataSource;
22539  node->valueSource = UA_VALUESOURCE_DATASOURCE;
22540  return UA_STATUSCODE_GOOD;
22541 }
22542 
22544 UA_Server_setVariableNode_dataSource(UA_Server *server, const UA_NodeId nodeId,
22545  const UA_DataSource dataSource) {
22546  UA_RCU_LOCK();
22547  UA_StatusCode retval = UA_Server_editNode(server, &adminSession, &nodeId,
22548  (UA_EditNodeCallback)setDataSource, &dataSource);
22549  UA_RCU_UNLOCK();
22550  return retval;
22551 }
22552 
22553 /****************************/
22554 /* Set Lifecycle Management */
22555 /****************************/
22556 
22557 static UA_StatusCode
22558 setOLM(UA_Server *server, UA_Session *session,
22559  UA_ObjectTypeNode* node, UA_ObjectLifecycleManagement *olm) {
22560  if(node->nodeClass != UA_NODECLASS_OBJECTTYPE)
22562  node->lifecycleManagement = *olm;
22563  return UA_STATUSCODE_GOOD;
22564 }
22565 
22568  UA_ObjectLifecycleManagement olm) {
22569  UA_RCU_LOCK();
22570  UA_StatusCode retval = UA_Server_editNode(server, &adminSession, &nodeId,
22571  (UA_EditNodeCallback)setOLM, &olm);
22572  UA_RCU_UNLOCK();
22573  return retval;
22574 }
22575 
22576 /***********************/
22577 /* Set Method Callback */
22578 /***********************/
22579 
22580 #ifdef UA_ENABLE_METHODCALLS
22581 
22582 struct addMethodCallback {
22583  UA_MethodCallback callback;
22584  void *handle;
22585 };
22586 
22587 static UA_StatusCode
22588 editMethodCallback(UA_Server *server, UA_Session* session,
22589  UA_Node* node, const void* handle) {
22590  if(node->nodeClass != UA_NODECLASS_METHOD)
22592  const struct addMethodCallback *newCallback = handle;
22593  UA_MethodNode *mnode = (UA_MethodNode*) node;
22594  mnode->attachedMethod = newCallback->callback;
22595  mnode->methodHandle = newCallback->handle;
22596  return UA_STATUSCODE_GOOD;
22597 }
22598 
22600 UA_Server_setMethodNode_callback(UA_Server *server, const UA_NodeId methodNodeId,
22601  UA_MethodCallback method, void *handle) {
22602  struct addMethodCallback cb = { method, handle };
22603  UA_RCU_LOCK();
22604  UA_StatusCode retval = UA_Server_editNode(server, &adminSession,
22605  &methodNodeId, editMethodCallback, &cb);
22606  UA_RCU_UNLOCK();
22607  return retval;
22608 }
22609 
22610 #endif
22611 
22612 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_view.c" ***********************************/
22613 
22614 /* This Source Code Form is subject to the terms of the Mozilla Public
22615 * License, v. 2.0. If a copy of the MPL was not distributed with this
22616 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
22617 
22618 
22619 static UA_StatusCode
22620 fillReferenceDescription(UA_NodeStore *ns, const UA_Node *curr, UA_ReferenceNode *ref,
22621  UA_UInt32 mask, UA_ReferenceDescription *descr) {
22622  UA_ReferenceDescription_init(descr);
22623  UA_StatusCode retval = UA_NodeId_copy(&curr->nodeId, &descr->nodeId.nodeId);
22625  retval |= UA_NodeId_copy(&ref->referenceTypeId, &descr->referenceTypeId);
22627  descr->isForward = !ref->isInverse;
22629  retval |= UA_NodeClass_copy(&curr->nodeClass, &descr->nodeClass);
22631  retval |= UA_QualifiedName_copy(&curr->browseName, &descr->browseName);
22633  retval |= UA_LocalizedText_copy(&curr->displayName, &descr->displayName);
22635  if(curr->nodeClass == UA_NODECLASS_OBJECT || curr->nodeClass == UA_NODECLASS_VARIABLE) {
22636  for(size_t i = 0; i < curr->referencesSize; ++i) {
22637  UA_ReferenceNode *refnode = &curr->references[i];
22639  retval |= UA_ExpandedNodeId_copy(&refnode->targetId, &descr->typeDefinition);
22640  break;
22641  }
22642  }
22643  }
22644  }
22645  return retval;
22646 }
22647 
22648 
22649 /* Tests if the node is relevant to the browse request and shall be returned. If
22650  so, it is retrieved from the Nodestore. If not, null is returned. */
22651 static const UA_Node *
22652 returnRelevantNode(UA_Server *server, const UA_BrowseDescription *descr, UA_Boolean return_all,
22653  const UA_ReferenceNode *reference, const UA_NodeId *relevant, size_t relevant_count,
22654  UA_Boolean *isExternal) {
22655  /* reference in the right direction? */
22656  if(reference->isInverse && descr->browseDirection == UA_BROWSEDIRECTION_FORWARD)
22657  return NULL;
22658  if(!reference->isInverse && descr->browseDirection == UA_BROWSEDIRECTION_INVERSE)
22659  return NULL;
22660 
22661  /* is the reference part of the hierarchy of references we look for? */
22662  if(!return_all) {
22663  UA_Boolean is_relevant = false;
22664  for(size_t i = 0; i < relevant_count; ++i) {
22665  if(UA_NodeId_equal(&reference->referenceTypeId, &relevant[i])) {
22666  is_relevant = true;
22667  break;
22668  }
22669  }
22670  if(!is_relevant)
22671  return NULL;
22672  }
22673 
22674 
22675  /* return from the internal nodestore */
22676  const UA_Node *node = UA_NodeStore_get(server->nodestore, &reference->targetId.nodeId);
22677  if(node && descr->nodeClassMask != 0 && (node->nodeClass & descr->nodeClassMask) == 0)
22678  return NULL;
22679  *isExternal = false;
22680  return node;
22681 }
22682 
22683 static void removeCp(struct ContinuationPointEntry *cp, UA_Session* session) {
22684  LIST_REMOVE(cp, pointers);
22685  UA_ByteString_deleteMembers(&cp->identifier);
22686  UA_BrowseDescription_deleteMembers(&cp->browseDescription);
22687  UA_free(cp);
22688  ++session->availableContinuationPoints;
22689 }
22690 
22691 /* Results for a single browsedescription. This is the inner loop for both
22692  * Browse and BrowseNext
22693  *
22694  * @param session Session to save continuationpoints
22695  * @param ns The nodstore where the to-be-browsed node can be found
22696  * @param cp If cp is not null, we continue from here If cp is null, we can add
22697  * a new continuation point if possible and necessary.
22698  * @param descr If no cp is set, we take the browsedescription from there
22699  * @param maxrefs The maximum number of references the client has requested. If 0,
22700  * all matching references are returned at once.
22701  * @param result The entry in the request */
22702 void
22703 Service_Browse_single(UA_Server *server, UA_Session *session,
22704  struct ContinuationPointEntry *cp, const UA_BrowseDescription *descr,
22705  UA_UInt32 maxrefs, UA_BrowseResult *result) {
22706  size_t referencesCount = 0;
22707  size_t referencesIndex = 0;
22708  /* set the browsedescription if a cp is given */
22709  UA_UInt32 continuationIndex = 0;
22710  if(cp) {
22711  descr = &cp->browseDescription;
22712  maxrefs = cp->maxReferences;
22713  continuationIndex = cp->continuationIndex;
22714  }
22715 
22716  /* is the browsedirection valid? */
22721  return;
22722  }
22723 
22724  /* get the references that match the browsedescription */
22725  size_t relevant_refs_size = 0;
22726  UA_NodeId *relevant_refs = NULL;
22727  UA_Boolean all_refs = UA_NodeId_isNull(&descr->referenceTypeId);
22728  if(!all_refs) {
22729  const UA_Node *rootRef = UA_NodeStore_get(server->nodestore, &descr->referenceTypeId);
22730  if(!rootRef || rootRef->nodeClass != UA_NODECLASS_REFERENCETYPE) {
22732  return;
22733  }
22734  if(descr->includeSubtypes) {
22735  result->statusCode = getTypeHierarchy(server->nodestore, rootRef, false,
22736  &relevant_refs, &relevant_refs_size);
22737  if(result->statusCode != UA_STATUSCODE_GOOD)
22738  return;
22739  } else {
22740  relevant_refs = (UA_NodeId*)(uintptr_t)&descr->referenceTypeId;
22741  relevant_refs_size = 1;
22742  }
22743  }
22744 
22745  /* get the node */
22746  const UA_Node *node = UA_NodeStore_get(server->nodestore, &descr->nodeId);
22747  if(!node) {
22749  if(!all_refs && descr->includeSubtypes)
22750  UA_Array_delete(relevant_refs, relevant_refs_size, &UA_TYPES[UA_TYPES_NODEID]);
22751  return;
22752  }
22753 
22754  /* if the node has no references, just return */
22755  if(node->referencesSize == 0) {
22756  result->referencesSize = 0;
22757  if(!all_refs && descr->includeSubtypes)
22758  UA_Array_delete(relevant_refs, relevant_refs_size, &UA_TYPES[UA_TYPES_NODEID]);
22759  return;
22760  }
22761 
22762  /* how many references can we return at most? */
22763  size_t real_maxrefs = maxrefs;
22764  if(real_maxrefs == 0)
22765  real_maxrefs = node->referencesSize;
22766  else if(real_maxrefs > node->referencesSize)
22767  real_maxrefs = node->referencesSize;
22769  if(!result->references) {
22771  goto cleanup;
22772  }
22773 
22774  /* loop over the node's references */
22775  size_t skipped = 0;
22776  UA_Boolean isExternal = false;
22778  for(; referencesIndex < node->referencesSize && referencesCount < real_maxrefs; ++referencesIndex) {
22779  isExternal = false;
22780  const UA_Node *current =
22781  returnRelevantNode(server, descr, all_refs, &node->references[referencesIndex],
22782  relevant_refs, relevant_refs_size, &isExternal);
22783  if(!current)
22784  continue;
22785 
22786  if(skipped < continuationIndex) {
22787  ++skipped;
22788  } else {
22789  retval |= fillReferenceDescription(server->nodestore, current,
22790  &node->references[referencesIndex],
22791  descr->resultMask,
22792  &result->references[referencesCount]);
22793  ++referencesCount;
22794  }
22795  }
22796  result->referencesSize = referencesCount;
22797 
22798  if(referencesCount == 0) {
22799  UA_free(result->references);
22800  result->references = NULL;
22801  result->referencesSize = 0;
22802  }
22803 
22804  if(retval != UA_STATUSCODE_GOOD) {
22805  UA_Array_delete(result->references, result->referencesSize,
22806  &UA_TYPES[UA_TYPES_REFERENCEDESCRIPTION]);
22807  result->references = NULL;
22808  result->referencesSize = 0;
22809  result->statusCode = retval;
22810  }
22811 
22812  cleanup:
22813  if(!all_refs && descr->includeSubtypes)
22814  UA_Array_delete(relevant_refs, relevant_refs_size, &UA_TYPES[UA_TYPES_NODEID]);
22815  if(result->statusCode != UA_STATUSCODE_GOOD)
22816  return;
22817 
22818  /* create, update, delete continuation points */
22819  if(cp) {
22820  if(referencesIndex == node->referencesSize) {
22821  /* all done, remove a finished continuationPoint */
22822  removeCp(cp, session);
22823  } else {
22824  /* update the cp and return the cp identifier */
22825  cp->continuationIndex += (UA_UInt32)referencesCount;
22826  UA_ByteString_copy(&cp->identifier, &result->continuationPoint);
22827  }
22828  } else if(maxrefs != 0 && referencesCount >= maxrefs) {
22829  /* create a cp */
22830  if(session->availableContinuationPoints <= 0 ||
22831  !(cp = UA_malloc(sizeof(struct ContinuationPointEntry)))) {
22833  return;
22834  }
22835  UA_BrowseDescription_copy(descr, &cp->browseDescription);
22836  cp->maxReferences = maxrefs;
22837  cp->continuationIndex = (UA_UInt32)referencesCount;
22838  UA_Guid *ident = UA_Guid_new();
22839  *ident = UA_Guid_random();
22840  cp->identifier.data = (UA_Byte*)ident;
22841  cp->identifier.length = sizeof(UA_Guid);
22842  UA_ByteString_copy(&cp->identifier, &result->continuationPoint);
22843 
22844  /* store the cp */
22845  LIST_INSERT_HEAD(&session->continuationPoints, cp, pointers);
22846  --session->availableContinuationPoints;
22847  }
22848 }
22849 
22850 void Service_Browse(UA_Server *server, UA_Session *session, const UA_BrowseRequest *request,
22851  UA_BrowseResponse *response) {
22852  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing BrowseRequest");
22853  if(!UA_NodeId_isNull(&request->view.viewId)) {
22855  return;
22856  }
22857 
22858  if(request->nodesToBrowseSize <= 0) {
22860  return;
22861  }
22862 
22863  size_t size = request->nodesToBrowseSize;
22864  response->results = UA_Array_new(size, &UA_TYPES[UA_TYPES_BROWSERESULT]);
22865  if(!response->results) {
22867  return;
22868  }
22869  response->resultsSize = size;
22870 
22871 
22872  for(size_t i = 0; i < size; ++i) {
22873  Service_Browse_single(server, session, NULL, &request->nodesToBrowse[i],
22874  request->requestedMaxReferencesPerNode, &response->results[i]);
22875  }
22876 }
22877 
22879 UA_Server_browse(UA_Server *server, UA_UInt32 maxrefs, const UA_BrowseDescription *descr) {
22880  UA_BrowseResult result;
22881  UA_BrowseResult_init(&result);
22882  UA_RCU_LOCK();
22883  Service_Browse_single(server, &adminSession, NULL, descr, maxrefs, &result);
22884  UA_RCU_UNLOCK();
22885  return result;
22886 }
22887 
22888 static void
22889 UA_Server_browseNext_single(UA_Server *server, UA_Session *session, UA_Boolean releaseContinuationPoint,
22890  const UA_ByteString *continuationPoint, UA_BrowseResult *result) {
22892  struct ContinuationPointEntry *cp, *temp;
22893  LIST_FOREACH_SAFE(cp, &session->continuationPoints, pointers, temp) {
22894  if(UA_ByteString_equal(&cp->identifier, continuationPoint)) {
22895  result->statusCode = UA_STATUSCODE_GOOD;
22896  if(!releaseContinuationPoint)
22897  Service_Browse_single(server, session, cp, NULL, 0, result);
22898  else
22899  removeCp(cp, session);
22900  break;
22901  }
22902  }
22903 }
22904 
22905 void Service_BrowseNext(UA_Server *server, UA_Session *session, const UA_BrowseNextRequest *request,
22906  UA_BrowseNextResponse *response) {
22907  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing BrowseNextRequest");
22908  if(request->continuationPointsSize <= 0) {
22910  return;
22911  }
22912  size_t size = request->continuationPointsSize;
22913  response->results = UA_Array_new(size, &UA_TYPES[UA_TYPES_BROWSERESULT]);
22914  if(!response->results) {
22916  return;
22917  }
22918 
22919  response->resultsSize = size;
22920  for(size_t i = 0; i < size; ++i)
22921  UA_Server_browseNext_single(server, session, request->releaseContinuationPoints,
22922  &request->continuationPoints[i], &response->results[i]);
22923 }
22924 
22926 UA_Server_browseNext(UA_Server *server, UA_Boolean releaseContinuationPoint,
22927  const UA_ByteString *continuationPoint) {
22928  UA_BrowseResult result;
22929  UA_BrowseResult_init(&result);
22930  UA_RCU_LOCK();
22931  UA_Server_browseNext_single(server, &adminSession, releaseContinuationPoint,
22932  continuationPoint, &result);
22933  UA_RCU_UNLOCK();
22934  return result;
22935 }
22936 
22937 /***********************/
22938 /* TranslateBrowsePath */
22939 /***********************/
22940 
22941 static void
22942 walkBrowsePathElementNodeReference(UA_BrowsePathResult *result, size_t *targetsSize,
22943  UA_NodeId **next, size_t *nextSize, size_t *nextCount,
22944  UA_UInt32 elemDepth, UA_Boolean inverse, UA_Boolean all_refs,
22945  const UA_NodeId *reftypes, size_t reftypes_count,
22946  const UA_ReferenceNode *reference) {
22947  /* Does the direction of the reference match? */
22948  if(reference->isInverse != inverse)
22949  return;
22950 
22951  /* Is the node relevant? */
22952  if(!all_refs) {
22953  UA_Boolean match = false;
22954  for(size_t j = 0; j < reftypes_count; ++j) {
22955  if(UA_NodeId_equal(&reference->referenceTypeId, &reftypes[j])) {
22956  match = true;
22957  break;
22958  }
22959  }
22960  if(!match)
22961  return;
22962  }
22963 
22964  /* Does the reference point to an external server? Then add to the
22965  * targets with the right path "depth" */
22966  if(reference->targetId.serverIndex != 0) {
22967  UA_BrowsePathTarget *tempTargets =
22968  UA_realloc(result->targets, sizeof(UA_BrowsePathTarget) * (*targetsSize) * 2);
22969  if(!tempTargets) {
22971  return;
22972  }
22973  result->targets = tempTargets;
22974  (*targetsSize) *= 2;
22975  result->statusCode = UA_ExpandedNodeId_copy(&reference->targetId,
22976  &result->targets[result->targetsSize].targetId);
22977  result->targets[result->targetsSize].remainingPathIndex = elemDepth;
22978  return;
22979  }
22980 
22981  /* Add the node to the next array for the following path element */
22982  if(*nextSize <= *nextCount) {
22983  UA_NodeId *tempNext = UA_realloc(*next, sizeof(UA_NodeId) * (*nextSize) * 2);
22984  if(!tempNext) {
22986  return;
22987  }
22988  *next = tempNext;
22989  (*nextSize) *= 2;
22990  }
22991  result->statusCode = UA_NodeId_copy(&reference->targetId.nodeId,
22992  &(*next)[*nextCount]);
22993  ++(*nextCount);
22994 }
22995 
22996 static void
22997 walkBrowsePathElement(UA_Server *server, UA_Session *session,
22998  UA_BrowsePathResult *result, size_t *targetsSize,
22999  const UA_RelativePathElement *elem, UA_UInt32 elemDepth,
23000  const UA_QualifiedName *targetName,
23001  const UA_NodeId *current, const size_t currentCount,
23002  UA_NodeId **next, size_t *nextSize, size_t *nextCount) {
23003  /* Get the full list of relevant referencetypes for this path element */
23004  UA_NodeId *reftypes = NULL;
23005  size_t reftypes_count = 1; // all_refs or no subtypes => 1
23006  UA_Boolean all_refs = false;
23007  if(UA_NodeId_isNull(&elem->referenceTypeId)) {
23008  all_refs = true;
23009  } else if(!elem->includeSubtypes) {
23010  reftypes = (UA_NodeId*)(uintptr_t)&elem->referenceTypeId; // ptr magic due to const cast
23011  } else {
23012  const UA_Node *rootRef = UA_NodeStore_get(server->nodestore, &elem->referenceTypeId);
23013  if(!rootRef || rootRef->nodeClass != UA_NODECLASS_REFERENCETYPE)
23014  return;
23015  UA_StatusCode retval =
23016  getTypeHierarchy(server->nodestore, rootRef, false, &reftypes, &reftypes_count);
23017  if(retval != UA_STATUSCODE_GOOD)
23018  return;
23019  }
23020 
23021  /* Iterate over all nodes at the current depth-level */
23022  for(size_t i = 0; i < currentCount; ++i) {
23023  /* Get the node */
23024  const UA_Node *node = UA_NodeStore_get(server->nodestore, &current[i]);
23025  if(!node) {
23026  /* If we cannot find the node at depth 0, the starting node does not exist */
23027  if(elemDepth == 0)
23029  continue;
23030  }
23031 
23032  /* Test whether the current node has the target name required in the
23033  * previous path element */
23034  if(targetName && (targetName->namespaceIndex != node->browseName.namespaceIndex ||
23035  !UA_String_equal(&targetName->name, &node->browseName.name)))
23036  continue;
23037 
23038  /* Walk over the references in the node */
23039  /* Loop over the nodes references */
23040  for(size_t r = 0; r < node->referencesSize &&
23041  result->statusCode == UA_STATUSCODE_GOOD; ++r) {
23042  UA_ReferenceNode *reference = &node->references[r];
23043  walkBrowsePathElementNodeReference(result, targetsSize, next, nextSize, nextCount,
23044  elemDepth, elem->isInverse, all_refs,
23045  reftypes, reftypes_count, reference);
23046  }
23047  }
23048 
23049  if(!all_refs && elem->includeSubtypes)
23050  UA_Array_delete(reftypes, reftypes_count, &UA_TYPES[UA_TYPES_NODEID]);
23051 }
23052 
23053 /* This assumes that result->targets has enough room for all currentCount elements */
23054 static void
23055 addBrowsePathTargets(UA_Server *server, UA_Session *session, UA_BrowsePathResult *result,
23056  const UA_QualifiedName *targetName, UA_NodeId *current, size_t currentCount) {
23057  for(size_t i = 0; i < currentCount; i++) {
23058  /* Get the node */
23059  const UA_Node *node = UA_NodeStore_get(server->nodestore, &current[i]);
23060  if(!node) {
23061  UA_NodeId_deleteMembers(&current[i]);
23062  continue;
23063  }
23064 
23065  /* Test whether the current node has the target name required in the
23066  * previous path element */
23067  if(targetName->namespaceIndex != node->browseName.namespaceIndex ||
23068  !UA_String_equal(&targetName->name, &node->browseName.name)) {
23069  UA_NodeId_deleteMembers(&current[i]);
23070  continue;
23071  }
23072 
23073  /* Move the nodeid to the target array */
23074  UA_BrowsePathTarget_init(&result->targets[result->targetsSize]);
23075  result->targets[result->targetsSize].targetId.nodeId = current[i];
23077  ++result->targetsSize;
23078  }
23079 }
23080 
23081 static void
23082 walkBrowsePath(UA_Server *server, UA_Session *session, const UA_BrowsePath *path,
23083  UA_BrowsePathResult *result, size_t targetsSize,
23084  UA_NodeId **current, size_t *currentSize, size_t *currentCount,
23085  UA_NodeId **next, size_t *nextSize, size_t *nextCount) {
23086  UA_assert(*currentCount == 1);
23087  UA_assert(*nextCount == 0);
23088 
23089  /* Points to the targetName of the _previous_ path element */
23090  const UA_QualifiedName *targetName = NULL;
23091 
23092  /* Iterate over path elements */
23093  UA_assert(path->relativePath.elementsSize > 0);
23094  for(UA_UInt32 i = 0; i < path->relativePath.elementsSize; ++i) {
23095  walkBrowsePathElement(server, session, result, &targetsSize,
23096  &path->relativePath.elements[i], i, targetName,
23097  *current, *currentCount, next, nextSize, nextCount);
23098 
23099  /* Clean members of current */
23100  for(size_t j = 0; j < *currentCount; j++)
23101  UA_NodeId_deleteMembers(&(*current)[j]);
23102  *currentCount = 0;
23103 
23104  /* When no targets are left or an error occurred. None of next's
23105  * elements will be copied to result->targets */
23106  if(*nextCount == 0 || result->statusCode != UA_STATUSCODE_GOOD) {
23107  UA_assert(*currentCount == 0);
23108  UA_assert(*nextCount == 0);
23109  return;
23110  }
23111 
23112  /* Exchange current and next for the next depth */
23113  size_t tSize = *currentSize; size_t tCount = *currentCount; UA_NodeId *tT = *current;
23114  *currentSize = *nextSize; *currentCount = *nextCount; *current = *next;
23115  *nextSize = tSize; *nextCount = tCount; *next = tT;
23116 
23117  /* Store the target name of the previous path element */
23118  targetName = &path->relativePath.elements[i].targetName;
23119  }
23120 
23121  UA_assert(targetName != NULL);
23122  UA_assert(*nextCount == 0);
23123 
23124  /* After the last BrowsePathElement, move members from current to the
23125  * result targets */
23126 
23127  /* Realloc if more space is needed */
23128  if(targetsSize < result->targetsSize + (*currentCount)) {
23129  UA_BrowsePathTarget *newTargets =
23131  (result->targetsSize + (*currentCount)));
23132  if(!newTargets) {
23134  for(size_t i = 0; i < *currentCount; ++i)
23135  UA_NodeId_deleteMembers(&(*current)[i]);
23136  *currentCount = 0;
23137  return;
23138  }
23139  result->targets = newTargets;
23140  }
23141 
23142  /* Move the elements of current to the targets */
23143  addBrowsePathTargets(server, session, result, targetName, *current, *currentCount);
23144  *currentCount = 0;
23145 }
23146 
23147 static void
23148 translateBrowsePathToNodeIds(UA_Server *server, UA_Session *session,
23149  const UA_BrowsePath *path, UA_BrowsePathResult *result) {
23150  if(path->relativePath.elementsSize <= 0) {
23152  return;
23153  }
23154 
23155  /* RelativePath elements must not have an empty targetName */
23156  for(size_t i = 0; i < path->relativePath.elementsSize; ++i) {
23157  if(UA_QualifiedName_isNull(&path->relativePath.elements[i].targetName)) {
23159  return;
23160  }
23161  }
23162 
23163  /* Allocate memory for the targets */
23164  size_t targetsSize = 10; /* When to realloc; the member count is stored in
23165  * result->targetsSize */
23166  result->targets = (UA_BrowsePathTarget*)UA_malloc(sizeof(UA_BrowsePathTarget) * targetsSize);
23167  if(!result->targets) {
23169  return;
23170  }
23171 
23172  /* Allocate memory for two temporary arrays. One with the results for the
23173  * previous depth of the path. The other for the new results at the current
23174  * depth. The two arrays alternate as we descend down the tree. */
23175  size_t currentSize = 10; /* When to realloc */
23176  size_t currentCount = 0; /* Current elements */
23177  UA_NodeId *current = (UA_NodeId*)UA_malloc(sizeof(UA_NodeId) * currentSize);
23178  if(!current) {
23180  UA_free(result->targets);
23181  return;
23182  }
23183  size_t nextSize = 10; /* When to realloc */
23184  size_t nextCount = 0; /* Current elements */
23185  UA_NodeId *next = (UA_NodeId*)UA_malloc(sizeof(UA_NodeId) * nextSize);
23186  if(!next) {
23188  UA_free(result->targets);
23189  UA_free(current);
23190  return;
23191  }
23192 
23193  /* Copy the starting node into current */
23194  result->statusCode = UA_NodeId_copy(&path->startingNode, &current[0]);
23195  if(result->statusCode != UA_STATUSCODE_GOOD) {
23196  UA_free(result->targets);
23197  UA_free(current);
23198  UA_free(next);
23199  return;
23200  }
23201  currentCount = 1;
23202 
23203  /* Walk the path elements */
23204  walkBrowsePath(server, session, path, result, targetsSize,
23205  &current, &currentSize, &currentCount,
23206  &next, &nextSize, &nextCount);
23207 
23208  UA_assert(currentCount == 0);
23209  UA_assert(nextCount == 0);
23210 
23211  /* No results => BadNoMatch status code */
23212  if(result->targetsSize == 0 && result->statusCode == UA_STATUSCODE_GOOD)
23214 
23215  /* Clean up the temporary arrays and the targets */
23216  UA_free(current);
23217  UA_free(next);
23218  if(result->statusCode != UA_STATUSCODE_GOOD) {
23219  for(size_t i = 0; i < result->targetsSize; ++i)
23220  UA_BrowsePathTarget_deleteMembers(&result->targets[i]);
23221  UA_free(result->targets);
23222  result->targets = NULL;
23223  result->targetsSize = 0;
23224  }
23225 }
23226 
23229  const UA_BrowsePath *browsePath) {
23230  UA_BrowsePathResult result;
23231  UA_BrowsePathResult_init(&result);
23232  UA_RCU_LOCK();
23233  translateBrowsePathToNodeIds(server, &adminSession, browsePath, &result);
23234  UA_RCU_UNLOCK();
23235  return result;
23236 }
23237 
23238 void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *session,
23241  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing TranslateBrowsePathsToNodeIdsRequest");
23242  if(request->browsePathsSize <= 0) {
23244  return;
23245  }
23246 
23247  size_t size = request->browsePathsSize;
23249  if(!response->results) {
23251  return;
23252  }
23253 
23254  response->resultsSize = size;
23255  for(size_t i = 0; i < size; ++i)
23256  translateBrowsePathToNodeIds(server, session, &request->browsePaths[i],
23257  &response->results[i]);
23258 
23259 }
23260 
23261 void Service_RegisterNodes(UA_Server *server, UA_Session *session, const UA_RegisterNodesRequest *request,
23262  UA_RegisterNodesResponse *response) {
23263  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing RegisterNodesRequest");
23264  //TODO: hang the nodeids to the session if really needed
23266  if(request->nodesToRegisterSize <= 0)
23268  else {
23269  response->responseHeader.serviceResult =
23271  (void**)&response->registeredNodeIds, &UA_TYPES[UA_TYPES_NODEID]);
23273  response->registeredNodeIdsSize = request->nodesToRegisterSize;
23274  }
23275 }
23276 
23277 void Service_UnregisterNodes(UA_Server *server, UA_Session *session, const UA_UnregisterNodesRequest *request,
23278  UA_UnregisterNodesResponse *response) {
23279  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing UnRegisterNodesRequest");
23280  //TODO: remove the nodeids from the session if really needed
23282  if(request->nodesToUnregisterSize==0)
23284 }
23285 
23286 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_call.c" ***********************************/
23287 
23288 /* This Source Code Form is subject to the terms of the Mozilla Public
23289 * License, v. 2.0. If a copy of the MPL was not distributed with this
23290 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
23291 
23292 
23293 #ifdef UA_ENABLE_METHODCALLS /* conditional compilation */
23294 
23295 static const UA_VariableNode *
23296 getArgumentsVariableNode(UA_Server *server, const UA_MethodNode *ofMethod,
23297  UA_String withBrowseName) {
23298  UA_NodeId hasProperty = UA_NODEID_NUMERIC(0, UA_NS0ID_HASPROPERTY);
23299  for(size_t i = 0; i < ofMethod->referencesSize; ++i) {
23300  if(ofMethod->references[i].isInverse == false &&
23301  UA_NodeId_equal(&hasProperty, &ofMethod->references[i].referenceTypeId)) {
23302  const UA_Node *refTarget =
23303  UA_NodeStore_get(server->nodestore, &ofMethod->references[i].targetId.nodeId);
23304  if(!refTarget)
23305  continue;
23306  if(refTarget->nodeClass == UA_NODECLASS_VARIABLE &&
23307  refTarget->browseName.namespaceIndex == 0 &&
23308  UA_String_equal(&withBrowseName, &refTarget->browseName.name)) {
23309  return (const UA_VariableNode*) refTarget;
23310  }
23311  }
23312  }
23313  return NULL;
23314 }
23315 
23316 static UA_StatusCode
23317 argumentsConformsToDefinition(UA_Server *server, const UA_VariableNode *argRequirements,
23318  size_t argsSize, UA_Variant *args) {
23319  if(argRequirements->value.data.value.value.type != &UA_TYPES[UA_TYPES_ARGUMENT])
23321  UA_Argument *argReqs = (UA_Argument*)argRequirements->value.data.value.value.data;
23322  size_t argReqsSize = argRequirements->value.data.value.value.arrayLength;
23323  if(argRequirements->valueSource != UA_VALUESOURCE_DATA)
23325  if(UA_Variant_isScalar(&argRequirements->value.data.value.value))
23326  argReqsSize = 1;
23327  if(argReqsSize > argsSize)
23329  if(argReqsSize != argsSize)
23331 
23333  for(size_t i = 0; i < argReqsSize; ++i)
23334  retval |= typeCheckValue(server, &argReqs[i].dataType, argReqs[i].valueRank,
23335  argReqs[i].arrayDimensionsSize, argReqs[i].arrayDimensions,
23336  &args[i], NULL, &args[i]);
23337  return retval;
23338 }
23339 
23340 void
23341 Service_Call_single(UA_Server *server, UA_Session *session,
23342  const UA_CallMethodRequest *request,
23343  UA_CallMethodResult *result) {
23344  /* Get/verify the method node */
23345  const UA_MethodNode *methodCalled =
23346  (const UA_MethodNode*)UA_NodeStore_get(server->nodestore, &request->methodId);
23347  if(!methodCalled) {
23349  return;
23350  }
23351  if(methodCalled->nodeClass != UA_NODECLASS_METHOD) {
23353  return;
23354  }
23355  if(!methodCalled->executable || !methodCalled->userExecutable || !methodCalled->attachedMethod) {
23356  result->statusCode = UA_STATUSCODE_BADNOTWRITABLE; // There is no NOTEXECUTABLE?
23357  return;
23358  }
23359 
23360  /* Get/verify the object node */
23361  const UA_ObjectNode *withObject =
23362  (const UA_ObjectNode*)UA_NodeStore_get(server->nodestore, &request->objectId);
23363  if(!withObject) {
23365  return;
23366  }
23367  if(withObject->nodeClass != UA_NODECLASS_OBJECT && withObject->nodeClass != UA_NODECLASS_OBJECTTYPE) {
23369  return;
23370  }
23371 
23372  /* Verify method/object relations. Object must have a hasComponent or a
23373  * subtype of hasComponent reference to the method node. Therefore, check
23374  * every reference between the parent object and the method node if there is
23375  * a hasComponent (or subtype) reference */
23376  UA_Boolean found = false;
23377  UA_NodeId hasComponentNodeId = UA_NODEID_NUMERIC(0,UA_NS0ID_HASCOMPONENT);
23378  UA_NodeId hasSubTypeNodeId = UA_NODEID_NUMERIC(0,UA_NS0ID_HASSUBTYPE);
23379  for(size_t i = 0; i < methodCalled->referencesSize; ++i) {
23380  if(methodCalled->references[i].isInverse &&
23381  UA_NodeId_equal(&methodCalled->references[i].targetId.nodeId, &withObject->nodeId)) {
23382  found = isNodeInTree(server->nodestore, &methodCalled->references[i].referenceTypeId,
23383  &hasComponentNodeId, &hasSubTypeNodeId, 1);
23384  if(found)
23385  break;
23386  }
23387  }
23388  if(!found) {
23390  return;
23391  }
23392 
23393  /* Verify Input Argument count, types and sizes */
23394  const UA_VariableNode *inputArguments =
23395  getArgumentsVariableNode(server, methodCalled, UA_STRING("InputArguments"));
23396 
23397  if(!inputArguments) {
23398  if(request->inputArgumentsSize > 0) {
23400  return;
23401  }
23402  } else {
23403  result->statusCode = argumentsConformsToDefinition(server, inputArguments,
23404  request->inputArgumentsSize,
23405  request->inputArguments);
23406  if(result->statusCode != UA_STATUSCODE_GOOD)
23407  return;
23408  }
23409 
23410  /* Allocate the output arguments */
23411  result->outputArgumentsSize = 0; /* the default */
23412  const UA_VariableNode *outputArguments =
23413  getArgumentsVariableNode(server, methodCalled, UA_STRING("OutputArguments"));
23414  if(outputArguments) {
23415  result->outputArguments = UA_Array_new(outputArguments->value.data.value.value.arrayLength,
23417  if(!result->outputArguments) {
23419  return;
23420  }
23421  result->outputArgumentsSize = outputArguments->value.data.value.value.arrayLength;
23422  }
23423 
23424  /* Call the method */
23425 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
23426  methodCallSession = session;
23427 #endif
23428  result->statusCode = methodCalled->attachedMethod(methodCalled->methodHandle, withObject->nodeId,
23429  request->inputArgumentsSize, request->inputArguments,
23430  result->outputArgumentsSize, result->outputArguments);
23431 #if defined(UA_ENABLE_METHODCALLS) && defined(UA_ENABLE_SUBSCRIPTIONS)
23432  methodCallSession = NULL;
23433 #endif
23434 
23435  /* TODO: Verify Output matches the argument definition */
23436 }
23437 
23438 void Service_Call(UA_Server *server, UA_Session *session,
23439  const UA_CallRequest *request,
23440  UA_CallResponse *response) {
23441  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing CallRequest");
23442  if(request->methodsToCallSize <= 0) {
23444  return;
23445  }
23446 
23448  if(!response->results) {
23450  return;
23451  }
23452  response->resultsSize = request->methodsToCallSize;
23453 
23454 
23455  for(size_t i = 0; i < request->methodsToCallSize;++i){
23456  Service_Call_single(server, session, &request->methodsToCall[i], &response->results[i]);
23457  }
23458 }
23459 
23461 UA_Server_call(UA_Server *server, const UA_CallMethodRequest *request) {
23462  UA_CallMethodResult result;
23463  UA_CallMethodResult_init(&result);
23464  Service_Call_single(server, &adminSession,
23465  request, &result);
23466  return result;
23467 }
23468 
23469 #endif /* UA_ENABLE_METHODCALLS */
23470 
23471 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_subscription.c" ***********************************/
23472 
23473 /* This Source Code Form is subject to the terms of the Mozilla Public
23474 * License, v. 2.0. If a copy of the MPL was not distributed with this
23475 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
23476 
23477 
23478 #ifdef UA_ENABLE_SUBSCRIPTIONS /* conditional compilation */
23479 
23480 #define UA_VALUENCODING_MAXSTACK 512
23481 
23482 /*****************/
23483 /* MonitoredItem */
23484 /*****************/
23485 
23488  if(!new)
23489  return NULL;
23490  new->subscription = NULL;
23491  new->currentQueueSize = 0;
23492  new->maxQueueSize = 0;
23493  new->monitoredItemType = UA_MONITOREDITEMTYPE_CHANGENOTIFY; /* currently hardcoded */
23494  new->timestampsToReturn = UA_TIMESTAMPSTORETURN_SOURCE;
23495  UA_String_init(&new->indexRange);
23496  TAILQ_INIT(&new->queue);
23497  UA_NodeId_init(&new->monitoredNodeId);
23498  new->lastSampledValue = UA_BYTESTRING_NULL;
23499  memset(&new->sampleJobGuid, 0, sizeof(UA_Guid));
23500  new->sampleJobIsRegistered = false;
23501  new->itemId = 0;
23502  return new;
23503 }
23504 
23505 void MonitoredItem_delete(UA_Server *server, UA_MonitoredItem *monitoredItem) {
23506  MonitoredItem_unregisterSampleJob(server, monitoredItem);
23507  /* clear the queued samples */
23508  MonitoredItem_queuedValue *val, *val_tmp;
23509  TAILQ_FOREACH_SAFE(val, &monitoredItem->queue, listEntry, val_tmp) {
23510  TAILQ_REMOVE(&monitoredItem->queue, val, listEntry);
23511  UA_DataValue_deleteMembers(&val->value);
23512  UA_free(val);
23513  }
23514  monitoredItem->currentQueueSize = 0;
23515  LIST_REMOVE(monitoredItem, listEntry);
23516  UA_String_deleteMembers(&monitoredItem->indexRange);
23517  UA_ByteString_deleteMembers(&monitoredItem->lastSampledValue);
23518  UA_NodeId_deleteMembers(&monitoredItem->monitoredNodeId);
23519  UA_free(monitoredItem);
23520 }
23521 
23522 static void
23523 ensureSpaceInMonitoredItemQueue(UA_MonitoredItem *mon) {
23524  if(mon->currentQueueSize < mon->maxQueueSize)
23525  return;
23526  MonitoredItem_queuedValue *queueItem;
23527  if(mon->discardOldest)
23528  queueItem = TAILQ_FIRST(&mon->queue);
23529  else
23530  queueItem = TAILQ_LAST(&mon->queue, QueueOfQueueDataValues);
23531  UA_assert(queueItem); /* When the currentQueueSize > 0, then there is an item */
23532  TAILQ_REMOVE(&mon->queue, queueItem, listEntry);
23533  UA_DataValue_deleteMembers(&queueItem->value);
23534  UA_free(queueItem);
23535  --mon->currentQueueSize;
23536 }
23537 
23538 /* Has this sample changed from the last one? The method may allocate additional
23539  * space for the encoding buffer. Detect the change in encoding->data. */
23540 static UA_StatusCode
23541 detectValueChange(UA_MonitoredItem *mon, UA_DataValue *value,
23542  UA_ByteString *encoding, UA_Boolean *changed) {
23543  /* Apply Filter */
23544  UA_Boolean hasValue = value->hasValue;
23545  if(mon->trigger == UA_DATACHANGETRIGGER_STATUS)
23546  value->hasValue = false;
23547 
23548  UA_Boolean hasServerTimestamp = value->hasServerTimestamp;
23549  UA_Boolean hasServerPicoseconds = value->hasServerPicoseconds;
23550  value->hasServerTimestamp = false;
23551  value->hasServerPicoseconds = false;
23552 
23553  UA_Boolean hasSourceTimestamp = value->hasSourceTimestamp;
23554  UA_Boolean hasSourcePicoseconds = value->hasSourcePicoseconds;
23555  if(mon->trigger < UA_DATACHANGETRIGGER_STATUSVALUETIMESTAMP) {
23556  value->hasSourceTimestamp = false;
23557  value->hasSourcePicoseconds = false;
23558  }
23559 
23560  /* Encode the data for comparison */
23562  size_t binsize = UA_calcSizeBinary(value, &UA_TYPES[UA_TYPES_DATAVALUE]);
23563  if(binsize == 0) {
23565  goto cleanup;
23566  }
23567 
23568  /* Allocate buffer on the heap if necessary */
23569  if(binsize > UA_VALUENCODING_MAXSTACK &&
23570  UA_ByteString_allocBuffer(encoding, binsize) != UA_STATUSCODE_GOOD) {
23572  goto cleanup;
23573  }
23574 
23575  /* Encode the value */
23576  size_t encodingOffset = 0;
23577  retval = UA_encodeBinary(value, &UA_TYPES[UA_TYPES_DATAVALUE],
23578  NULL, NULL, encoding, &encodingOffset);
23579  if(retval != UA_STATUSCODE_GOOD)
23580  goto cleanup;
23581 
23582  /* The value has changed */
23583  encoding->length = encodingOffset;
23584  if(!mon->lastSampledValue.data || !UA_String_equal(encoding, &mon->lastSampledValue))
23585  *changed = true;
23586 
23587  cleanup:
23588  /* Reset the filter */
23589  value->hasValue = hasValue;
23590  value->hasServerTimestamp = hasServerTimestamp;
23591  value->hasServerPicoseconds = hasServerPicoseconds;
23592  value->hasSourceTimestamp = hasSourceTimestamp;
23593  value->hasSourcePicoseconds = hasSourcePicoseconds;
23594  return retval;
23595 }
23596 
23597 void UA_MoniteredItem_SampleCallback(UA_Server *server, UA_MonitoredItem *monitoredItem) {
23598  UA_Subscription *sub = monitoredItem->subscription;
23599  if(monitoredItem->monitoredItemType != UA_MONITOREDITEMTYPE_CHANGENOTIFY) {
23600  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
23601  "Subscription %u | MonitoredItem %i | "
23602  "Not a data change notification",
23603  sub->subscriptionID, monitoredItem->itemId);
23604  return;
23605  }
23606 
23607  /* Read the value */
23608  UA_ReadValueId rvid;
23609  UA_ReadValueId_init(&rvid);
23610  rvid.nodeId = monitoredItem->monitoredNodeId;
23611  rvid.attributeId = monitoredItem->attributeID;
23612  rvid.indexRange = monitoredItem->indexRange;
23613  UA_DataValue value;
23614  UA_DataValue_init(&value);
23615  Service_Read_single(server, sub->session, monitoredItem->timestampsToReturn,
23616  &rvid, &value);
23617 
23618  /* Stack-allocate some memory for the value encoding */
23619  UA_Byte *stackValueEncoding = UA_alloca(UA_VALUENCODING_MAXSTACK);
23620  UA_ByteString valueEncoding;
23621  valueEncoding.data = stackValueEncoding;
23622  valueEncoding.length = UA_VALUENCODING_MAXSTACK;
23623 
23624  /* Has the value changed? */
23625  UA_Boolean changed = false;
23626  UA_StatusCode retval = detectValueChange(monitoredItem, &value,
23627  &valueEncoding, &changed);
23628  if(!changed || retval != UA_STATUSCODE_GOOD)
23629  goto cleanup;
23630 
23631  /* Allocate the entry for the publish queue */
23633  if(!newQueueItem) {
23634  UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
23635  "Subscription %u | MonitoredItem %i | "
23636  "Item for the publishing queue could not be allocated",
23637  sub->subscriptionID, monitoredItem->itemId);
23638  goto cleanup;
23639  }
23640 
23641  /* Copy valueEncoding on the heap for the next comparison (if not already done) */
23642  if(valueEncoding.data == stackValueEncoding) {
23643  UA_ByteString cbs;
23644  if(UA_ByteString_copy(&valueEncoding, &cbs) != UA_STATUSCODE_GOOD) {
23645  UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
23646  "Subscription %u | MonitoredItem %i | "
23647  "ByteString to compare values could not be created",
23648  sub->subscriptionID, monitoredItem->itemId);
23649  UA_free(newQueueItem);
23650  goto cleanup;
23651  }
23652  valueEncoding = cbs;
23653  }
23654 
23655  /* Prepare the newQueueItem */
23656  if(value.hasValue && value.value.storageType == UA_VARIANT_DATA_NODELETE) {
23657  if(UA_DataValue_copy(&value, &newQueueItem->value) != UA_STATUSCODE_GOOD) {
23658  UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
23659  "Subscription %u | MonitoredItem %i | "
23660  "Item for the publishing queue could not be prepared",
23661  sub->subscriptionID, monitoredItem->itemId);
23662  UA_free(newQueueItem);
23663  goto cleanup;
23664  }
23665  } else {
23666  newQueueItem->value = value;
23667  }
23668  newQueueItem->clientHandle = monitoredItem->clientHandle;
23669 
23670  /* <-- Point of no return --> */
23671 
23672  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
23673  "Subscription %u | MonitoredItem %u | Sampled a new value",
23674  sub->subscriptionID, monitoredItem->itemId);
23675 
23676  /* Replace the encoding for comparison */
23677  UA_ByteString_deleteMembers(&monitoredItem->lastSampledValue);
23678  monitoredItem->lastSampledValue = valueEncoding;
23679 
23680  /* Add the sample to the queue for publication */
23681  ensureSpaceInMonitoredItemQueue(monitoredItem);
23682  TAILQ_INSERT_TAIL(&monitoredItem->queue, newQueueItem, listEntry);
23683  ++monitoredItem->currentQueueSize;
23684  return;
23685 
23686  cleanup:
23687  if(valueEncoding.data != stackValueEncoding)
23688  UA_ByteString_deleteMembers(&valueEncoding);
23689  UA_DataValue_deleteMembers(&value);
23690 }
23691 
23693 MonitoredItem_registerSampleJob(UA_Server *server, UA_MonitoredItem *mon) {
23694  UA_Job job;
23695  job.type = UA_JOBTYPE_METHODCALL;
23696  job.job.methodCall.method = (UA_ServerCallback)UA_MoniteredItem_SampleCallback;
23697  job.job.methodCall.data = mon;
23698  UA_StatusCode retval = UA_Server_addRepeatedJob(server, job,
23699  (UA_UInt32)mon->samplingInterval,
23700  &mon->sampleJobGuid);
23701  if(retval == UA_STATUSCODE_GOOD)
23702  mon->sampleJobIsRegistered = true;
23703  return retval;
23704 }
23705 
23707  if(!mon->sampleJobIsRegistered)
23708  return UA_STATUSCODE_GOOD;
23709  mon->sampleJobIsRegistered = false;
23710  return UA_Server_removeRepeatedJob(server, mon->sampleJobGuid);
23711 }
23712 
23713 /****************/
23714 /* Subscription */
23715 /****************/
23716 
23717 UA_Subscription * UA_Subscription_new(UA_Session *session, UA_UInt32 subscriptionID) {
23718  UA_Subscription *new = UA_malloc(sizeof(UA_Subscription));
23719  if(!new)
23720  return NULL;
23721  new->session = session;
23722  new->subscriptionID = subscriptionID;
23723  new->sequenceNumber = 0;
23724  new->maxKeepAliveCount = 0;
23725  new->publishingEnabled = false;
23726  memset(&new->publishJobGuid, 0, sizeof(UA_Guid));
23727  new->publishJobIsRegistered = false;
23728  new->currentKeepAliveCount = 0;
23729  new->currentLifetimeCount = 0;
23730  new->lastMonitoredItemId = 0;
23731  new->state = UA_SUBSCRIPTIONSTATE_NORMAL; /* The first publish response is sent immediately */
23732  LIST_INIT(&new->monitoredItems);
23733  TAILQ_INIT(&new->retransmissionQueue);
23734  new->retransmissionQueueSize = 0;
23735  return new;
23736 }
23737 
23738 void UA_Subscription_deleteMembers(UA_Subscription *subscription, UA_Server *server) {
23739  Subscription_unregisterPublishJob(server, subscription);
23740 
23741  /* Delete monitored Items */
23742  UA_MonitoredItem *mon, *tmp_mon;
23743  LIST_FOREACH_SAFE(mon, &subscription->monitoredItems, listEntry, tmp_mon) {
23744  LIST_REMOVE(mon, listEntry);
23745  MonitoredItem_delete(server, mon);
23746  }
23747 
23748  /* Delete Retransmission Queue */
23749  UA_NotificationMessageEntry *nme, *nme_tmp;
23750  TAILQ_FOREACH_SAFE(nme, &subscription->retransmissionQueue, listEntry, nme_tmp) {
23751  TAILQ_REMOVE(&subscription->retransmissionQueue, nme, listEntry);
23752  UA_NotificationMessage_deleteMembers(&nme->message);
23753  UA_free(nme);
23754  }
23755  subscription->retransmissionQueueSize = 0;
23756 }
23757 
23760  UA_MonitoredItem *mon;
23761  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
23762  if(mon->itemId == monitoredItemID)
23763  break;
23764  }
23765  return mon;
23766 }
23767 
23770  UA_UInt32 monitoredItemID) {
23771  UA_MonitoredItem *mon;
23772  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
23773  if(mon->itemId == monitoredItemID) {
23774  LIST_REMOVE(mon, listEntry);
23775  MonitoredItem_delete(server, mon);
23776  return UA_STATUSCODE_GOOD;
23777  }
23778  }
23780 }
23781 
23782 static size_t
23783 countQueuedNotifications(UA_Subscription *sub, UA_Boolean *moreNotifications) {
23784  size_t notifications = 0;
23785  if(sub->publishingEnabled) {
23786  UA_MonitoredItem *mon;
23787  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
23789  TAILQ_FOREACH(qv, &mon->queue, listEntry) {
23790  if(notifications >= sub->notificationsPerPublish) {
23791  *moreNotifications = true;
23792  break;
23793  }
23794  ++notifications;
23795  }
23796  }
23797  }
23798  return notifications;
23799 }
23800 
23801 static void
23802 UA_Subscription_addRetransmissionMessage(UA_Server *server, UA_Subscription *sub,
23803  UA_NotificationMessageEntry *entry) {
23804  /* Release the oldest entry if there is not enough space */
23805  if(server->config.maxRetransmissionQueueSize > 0 &&
23806  sub->retransmissionQueueSize >= server->config.maxRetransmissionQueueSize) {
23807  UA_NotificationMessageEntry *lastentry =
23808  TAILQ_LAST(&sub->retransmissionQueue, UA_ListOfNotificationMessages);
23809  TAILQ_REMOVE(&sub->retransmissionQueue, lastentry, listEntry);
23810  --sub->retransmissionQueueSize;
23811  UA_NotificationMessage_deleteMembers(&lastentry->message);
23812  UA_free(lastentry);
23813  }
23814 
23815  /* Add entry */
23816  TAILQ_INSERT_HEAD(&sub->retransmissionQueue, entry, listEntry);
23817  ++sub->retransmissionQueueSize;
23818 }
23819 
23822  UA_NotificationMessageEntry *entry, *entry_tmp;
23823  TAILQ_FOREACH_SAFE(entry, &sub->retransmissionQueue, listEntry, entry_tmp) {
23824  if(entry->message.sequenceNumber != sequenceNumber)
23825  continue;
23826  TAILQ_REMOVE(&sub->retransmissionQueue, entry, listEntry);
23827  --sub->retransmissionQueueSize;
23828  UA_NotificationMessage_deleteMembers(&entry->message);
23829  UA_free(entry);
23830  return UA_STATUSCODE_GOOD;
23831  }
23833 }
23834 
23835 static UA_StatusCode
23836 prepareNotificationMessage(UA_Subscription *sub, UA_NotificationMessage *message,
23837  size_t notifications) {
23838  /* Array of ExtensionObject to hold different kinds of notifications
23839  (currently only DataChangeNotifications) */
23841  if(!message->notificationData)
23843  message->notificationDataSize = 1;
23844 
23845  /* Allocate Notification */
23846  UA_DataChangeNotification *dcn = UA_DataChangeNotification_new();
23847  if(!dcn)
23848  goto cleanup;
23849  UA_ExtensionObject *data = message->notificationData;
23851  data->content.decoded.data = dcn;
23853 
23854  /* Allocate array of notifications */
23855  dcn->monitoredItems =
23857  if(!dcn->monitoredItems)
23858  goto cleanup;
23859  dcn->monitoredItemsSize = notifications;
23860 
23861  /* Move notifications into the response .. the point of no return */
23862  size_t l = 0;
23863  UA_MonitoredItem *mon;
23864  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
23865  MonitoredItem_queuedValue *qv, *qv_tmp;
23866  TAILQ_FOREACH_SAFE(qv, &mon->queue, listEntry, qv_tmp) {
23867  if(l >= notifications)
23868  return UA_STATUSCODE_GOOD;
23870  min->clientHandle = qv->clientHandle;
23871  min->value = qv->value;
23872  TAILQ_REMOVE(&mon->queue, qv, listEntry);
23873  UA_free(qv);
23874  --mon->currentQueueSize;
23875  ++l;
23876  }
23877  }
23878  return UA_STATUSCODE_GOOD;
23879 
23880  cleanup:
23881  UA_NotificationMessage_deleteMembers(message);
23883 }
23884 
23885 void UA_Subscription_publishCallback(UA_Server *server, UA_Subscription *sub) {
23886  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session, "Subscription %u | "
23887  "Publish Callback", sub->subscriptionID);
23888 
23889  /* Count the available notifications */
23890  UA_Boolean moreNotifications = false;
23891  size_t notifications = countQueuedNotifications(sub, &moreNotifications);
23892 
23893  /* Return if nothing to do */
23894  if(notifications == 0) {
23895  ++sub->currentKeepAliveCount;
23896  if(sub->currentKeepAliveCount < sub->maxKeepAliveCount)
23897  return;
23898  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
23899  "Subscription %u | Sending a KeepAlive",
23900  sub->subscriptionID)
23901  }
23902 
23903  /* Check if the securechannel is valid */
23904  UA_SecureChannel *channel = sub->session->channel;
23905  if(!channel)
23906  return;
23907 
23908  /* Dequeue a response */
23909  UA_PublishResponseEntry *pre = SIMPLEQ_FIRST(&sub->session->responseQueue);
23910 
23911  /* Cannot publish without a response */
23912  if(!pre) {
23913  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
23914  "Subscription %u | Cannot send a publish response "
23915  "since the publish queue is empty", sub->subscriptionID)
23916  if(sub->state != UA_SUBSCRIPTIONSTATE_LATE) {
23917  sub->state = UA_SUBSCRIPTIONSTATE_LATE;
23918  } else {
23919  ++sub->currentLifetimeCount;
23920  if(sub->currentLifetimeCount > sub->lifeTimeCount) {
23921  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session, "Subscription %u | "
23922  "End of lifetime for subscription", sub->subscriptionID);
23923  UA_Session_deleteSubscription(server, sub->session, sub->subscriptionID);
23924  }
23925  }
23926  return;
23927  }
23928 
23929  UA_PublishResponse *response = &pre->response;
23930  UA_NotificationMessage *message = &response->notificationMessage;
23931  UA_NotificationMessageEntry *retransmission = NULL;
23932  if(notifications > 0) {
23933  /* Allocate the retransmission entry */
23934  retransmission = UA_malloc(sizeof(UA_NotificationMessageEntry));
23935  if(!retransmission) {
23936  UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
23937  "Subscription %u | Could not allocate memory "
23938  "for retransmission", sub->subscriptionID);
23939  return;
23940  }
23941  /* Prepare the response */
23942  UA_StatusCode retval =
23943  prepareNotificationMessage(sub, message, notifications);
23944  if(retval != UA_STATUSCODE_GOOD) {
23945  UA_LOG_WARNING_SESSION(server->config.logger, sub->session,
23946  "Subscription %u | Could not prepare the "
23947  "notification message", sub->subscriptionID);
23948  UA_free(retransmission);
23949  return;
23950  }
23951  }
23952 
23953  /* <-- The point of no return --> */
23954 
23955  /* Remove the response from the response queue */
23956  SIMPLEQ_REMOVE_HEAD(&sub->session->responseQueue, listEntry);
23957 
23958  /* Set up the response */
23960  response->subscriptionId = sub->subscriptionID;
23961  response->moreNotifications = moreNotifications;
23962  message->publishTime = response->responseHeader.timestamp;
23963  if(notifications == 0) {
23964  /* Send sequence number for the next notification */
23965  message->sequenceNumber = sub->sequenceNumber + 1;
23966  } else {
23967  /* Increase the sequence number */
23968  message->sequenceNumber = ++sub->sequenceNumber;
23969 
23970  /* Put the notification message into the retransmission queue. This needs to
23971  * be done here, so that the message itself is included in the available
23972  * sequence numbers for acknowledgement. */
23973  retransmission->message = response->notificationMessage;
23974  UA_Subscription_addRetransmissionMessage(server, sub, retransmission);
23975  }
23976 
23977  /* Get the available sequence numbers from the retransmission queue */
23978  size_t available = sub->retransmissionQueueSize;
23979  if(available > 0) {
23980  response->availableSequenceNumbers = UA_alloca(available * sizeof(UA_UInt32));
23981  response->availableSequenceNumbersSize = available;
23982  size_t i = 0;
23984  TAILQ_FOREACH(nme, &sub->retransmissionQueue, listEntry) {
23985  response->availableSequenceNumbers[i] = nme->message.sequenceNumber;
23986  ++i;
23987  }
23988  }
23989 
23990  /* Send the response */
23991  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
23992  "Subscription %u | Sending out a publish response with %u "
23993  "notifications", sub->subscriptionID, (UA_UInt32)notifications);
23994  UA_SecureChannel_sendBinaryMessage(sub->session->channel, pre->requestId, response,
23996 
23997  /* Reset subscription state to normal. */
23998  sub->state = UA_SUBSCRIPTIONSTATE_NORMAL;
23999  sub->currentKeepAliveCount = 0;
24000  sub->currentLifetimeCount = 0;
24001 
24002  /* Free the response */
24003  UA_Array_delete(response->results, response->resultsSize,
24005  UA_free(pre); /* no need for UA_PublishResponse_deleteMembers */
24006 
24007  /* Repeat if there are more notifications to send */
24008  if(moreNotifications)
24009  UA_Subscription_publishCallback(server, sub);
24010 }
24011 
24013 Subscription_registerPublishJob(UA_Server *server, UA_Subscription *sub) {
24014  if(sub->publishJobIsRegistered)
24015  return UA_STATUSCODE_GOOD;
24016 
24017  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
24018  "Subscription %u | Register subscription publishing callback",
24019  sub->subscriptionID);
24020  UA_Job job;
24021  job.type = UA_JOBTYPE_METHODCALL;
24022  job.job.methodCall.method = (UA_ServerCallback)UA_Subscription_publishCallback;
24023  job.job.methodCall.data = sub;
24024  UA_StatusCode retval =
24025  UA_Server_addRepeatedJob(server, job, (UA_UInt32)sub->publishingInterval,
24026  &sub->publishJobGuid);
24027  if(retval == UA_STATUSCODE_GOOD)
24028  sub->publishJobIsRegistered = true;
24029  return retval;
24030 }
24031 
24033 Subscription_unregisterPublishJob(UA_Server *server, UA_Subscription *sub) {
24034  if(!sub->publishJobIsRegistered)
24035  return UA_STATUSCODE_GOOD;
24036  UA_LOG_DEBUG_SESSION(server->config.logger, sub->session,
24037  "Subscription %u | Unregister subscription publishing callback",
24038  sub->subscriptionID);
24039  sub->publishJobIsRegistered = false;
24040  return UA_Server_removeRepeatedJob(server, sub->publishJobGuid);
24041 }
24042 
24043 /* When the session has publish requests stored but the last subscription is
24044  deleted... Send out empty responses */
24045 void
24046 UA_Subscription_answerPublishRequestsNoSubscription(UA_Server *server, UA_NodeId *sessionToken) {
24047  /* Get session */
24048  UA_Session *session = UA_SessionManager_getSession(&server->sessionManager, sessionToken);
24049  UA_NodeId_delete(sessionToken);
24050 
24051  /* No session or there are remaining subscriptions */
24052  if(!session || LIST_FIRST(&session->serverSubscriptions))
24053  return;
24054 
24055  /* Send a response for every queued request */
24056  UA_PublishResponseEntry *pre;
24057  while((pre = SIMPLEQ_FIRST(&session->responseQueue))) {
24058  SIMPLEQ_REMOVE_HEAD(&session->responseQueue, listEntry);
24059  UA_PublishResponse *response = &pre->response;
24062  UA_SecureChannel_sendBinaryMessage(session->channel, pre->requestId, response,
24064  UA_PublishResponse_deleteMembers(response);
24065  UA_free(pre);
24066  }
24067 }
24068 
24069 #endif /* UA_ENABLE_SUBSCRIPTIONS */
24070 
24071 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/server/ua_services_subscription.c" ***********************************/
24072 
24073 /* This Source Code Form is subject to the terms of the Mozilla Public
24074 * License, v. 2.0. If a copy of the MPL was not distributed with this
24075 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
24076 
24077 
24078 #ifdef UA_ENABLE_SUBSCRIPTIONS /* conditional compilation */
24079 
24080 #define UA_BOUNDEDVALUE_SETWBOUNDS(BOUNDS, SRC, DST) { \
24081  if(SRC > BOUNDS.max) DST = BOUNDS.max; \
24082  else if(SRC < BOUNDS.min) DST = BOUNDS.min; \
24083  else DST = SRC; \
24084  }
24085 
24086 static void
24087 setSubscriptionSettings(UA_Server *server, UA_Subscription *subscription,
24088  UA_Double requestedPublishingInterval,
24089  UA_UInt32 requestedLifetimeCount,
24090  UA_UInt32 requestedMaxKeepAliveCount,
24091  UA_UInt32 maxNotificationsPerPublish, UA_Byte priority) {
24092  /* deregister the job if required */
24093  UA_StatusCode retval = Subscription_unregisterPublishJob(server, subscription);
24094  if(retval != UA_STATUSCODE_GOOD)
24095  UA_LOG_DEBUG_SESSION(server->config.logger, subscription->session, "Subscription %u | "
24096  "Could not unregister publish job with error code 0x%08x",
24097  subscription->subscriptionID, retval);
24098 
24099  /* re-parameterize the subscription */
24100  subscription->publishingInterval = requestedPublishingInterval;
24101  UA_BOUNDEDVALUE_SETWBOUNDS(server->config.publishingIntervalLimits,
24102  requestedPublishingInterval, subscription->publishingInterval);
24103  /* check for nan*/
24104  if(requestedPublishingInterval != requestedPublishingInterval)
24105  subscription->publishingInterval = server->config.publishingIntervalLimits.min;
24106  UA_BOUNDEDVALUE_SETWBOUNDS(server->config.keepAliveCountLimits,
24107  requestedMaxKeepAliveCount, subscription->maxKeepAliveCount);
24108  UA_BOUNDEDVALUE_SETWBOUNDS(server->config.lifeTimeCountLimits,
24109  requestedLifetimeCount, subscription->lifeTimeCount);
24110  if(subscription->lifeTimeCount < 3 * subscription->maxKeepAliveCount)
24111  subscription->lifeTimeCount = 3 * subscription->maxKeepAliveCount;
24112  subscription->notificationsPerPublish = maxNotificationsPerPublish;
24113  if(maxNotificationsPerPublish == 0 ||
24114  maxNotificationsPerPublish > server->config.maxNotificationsPerPublish)
24115  subscription->notificationsPerPublish = server->config.maxNotificationsPerPublish;
24116  subscription->priority = priority;
24117 
24118  retval = Subscription_registerPublishJob(server, subscription);
24119  if(retval != UA_STATUSCODE_GOOD)
24120  UA_LOG_DEBUG_SESSION(server->config.logger, subscription->session, "Subscription %u | "
24121  "Could not register publish job with error code 0x%08x",
24122  subscription->subscriptionID, retval);
24123 }
24124 
24125 void
24126 Service_CreateSubscription(UA_Server *server, UA_Session *session,
24127  const UA_CreateSubscriptionRequest *request,
24128  UA_CreateSubscriptionResponse *response) {
24129  /* Create the subscription */
24130  UA_Subscription *newSubscription = UA_Subscription_new(session, response->subscriptionId);
24131  if(!newSubscription) {
24132  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24133  "Processing CreateSubscriptionRequest failed");
24135  return;
24136  }
24137  newSubscription->subscriptionID = UA_Session_getUniqueSubscriptionID(session);
24138  UA_Session_addSubscription(session, newSubscription);
24139 
24140  /* Set the subscription parameters */
24141  newSubscription->publishingEnabled = request->publishingEnabled;
24142  setSubscriptionSettings(server, newSubscription, request->requestedPublishingInterval,
24144  request->maxNotificationsPerPublish, request->priority);
24145  newSubscription->currentKeepAliveCount = newSubscription->maxKeepAliveCount; /* set settings first */
24146 
24147  /* Prepare the response */
24148  response->subscriptionId = newSubscription->subscriptionID;
24149  response->revisedPublishingInterval = newSubscription->publishingInterval;
24150  response->revisedLifetimeCount = newSubscription->lifeTimeCount;
24151  response->revisedMaxKeepAliveCount = newSubscription->maxKeepAliveCount;
24152 
24153  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24154  "CreateSubscriptionRequest: Created Subscription %u "
24155  "with a publishing interval of %f ms", response->subscriptionId,
24156  newSubscription->publishingInterval);
24157 }
24158 
24159 void
24160 Service_ModifySubscription(UA_Server *server, UA_Session *session,
24161  const UA_ModifySubscriptionRequest *request,
24162  UA_ModifySubscriptionResponse *response) {
24163  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24164  "Processing ModifySubscriptionRequest");
24165  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24166  if(!sub) {
24168  return;
24169  }
24170 
24171  setSubscriptionSettings(server, sub, request->requestedPublishingInterval,
24173  request->maxNotificationsPerPublish, request->priority);
24174  sub->currentLifetimeCount = 0; /* Reset the subscription lifetime */
24175  response->revisedPublishingInterval = sub->publishingInterval;
24176  response->revisedLifetimeCount = sub->lifeTimeCount;
24177  response->revisedMaxKeepAliveCount = sub->maxKeepAliveCount;
24178 }
24179 
24180 void
24181 Service_SetPublishingMode(UA_Server *server, UA_Session *session,
24182  const UA_SetPublishingModeRequest *request,
24183  UA_SetPublishingModeResponse *response) {
24184  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24185  "Processing SetPublishingModeRequest");
24186  if(request->subscriptionIdsSize <= 0) {
24188  return;
24189  }
24190 
24191  size_t size = request->subscriptionIdsSize;
24192  response->results = UA_Array_new(size, &UA_TYPES[UA_TYPES_STATUSCODE]);
24193  if(!response->results) {
24195  return;
24196  }
24197 
24198  response->resultsSize = size;
24199  for(size_t i = 0; i < size; ++i) {
24200  UA_Subscription *sub =
24201  UA_Session_getSubscriptionByID(session, request->subscriptionIds[i]);
24202  if(!sub) {
24204  continue;
24205  }
24206  if(sub->publishingEnabled != request->publishingEnabled) {
24207  sub->publishingEnabled = request->publishingEnabled;
24208  sub->currentLifetimeCount = 0; /* Reset the subscription lifetime */
24209  }
24210  }
24211 }
24212 
24213 static void
24214 setMonitoredItemSettings(UA_Server *server, UA_MonitoredItem *mon,
24215  UA_MonitoringMode monitoringMode,
24216  const UA_MonitoringParameters *params) {
24217  MonitoredItem_unregisterSampleJob(server, mon);
24218  mon->monitoringMode = monitoringMode;
24219 
24220  /* ClientHandle */
24221  mon->clientHandle = params->clientHandle;
24222 
24223  /* SamplingInterval */
24224  UA_Double samplingInterval = params->samplingInterval;
24225  if(mon->attributeID == UA_ATTRIBUTEID_VALUE) {
24226  const UA_VariableNode *vn = (const UA_VariableNode*)
24227  UA_NodeStore_get(server->nodestore, &mon->monitoredNodeId);
24228  if(vn && vn->nodeClass == UA_NODECLASS_VARIABLE &&
24229  samplingInterval < vn->minimumSamplingInterval)
24230  samplingInterval = vn->minimumSamplingInterval;
24231  } else if(mon->attributeID == UA_ATTRIBUTEID_EVENTNOTIFIER) {
24232  /* TODO: events should not need a samplinginterval */
24233  samplingInterval = 10000.0f; // 10 seconds to reduce the load
24234  }
24235  mon->samplingInterval = samplingInterval;
24236  UA_BOUNDEDVALUE_SETWBOUNDS(server->config.samplingIntervalLimits,
24237  samplingInterval, mon->samplingInterval);
24238  if(samplingInterval != samplingInterval) /* Check for nan */
24239  mon->samplingInterval = server->config.samplingIntervalLimits.min;
24240 
24241  /* Filter */
24242  if(params->filter.encoding != UA_EXTENSIONOBJECT_DECODED ||
24244  /* Default: Trigger only on the value and the statuscode */
24245  mon->trigger = UA_DATACHANGETRIGGER_STATUSVALUE;
24246  } else {
24247  UA_DataChangeFilter *filter = params->filter.content.decoded.data;
24248  mon->trigger = filter->trigger;
24249  }
24250 
24251  /* QueueSize */
24252  UA_BOUNDEDVALUE_SETWBOUNDS(server->config.queueSizeLimits,
24253  params->queueSize, mon->maxQueueSize);
24254 
24255  /* DiscardOldest */
24256  mon->discardOldest = params->discardOldest;
24257 
24258  /* Register sample job if reporting is enabled */
24259  if(monitoringMode == UA_MONITORINGMODE_REPORTING)
24260  MonitoredItem_registerSampleJob(server, mon);
24261 }
24262 
24263 static const UA_String binaryEncoding = {sizeof("Default Binary")-1, (UA_Byte*)"Default Binary"};
24264 /* static const UA_String xmlEncoding = {sizeof("Default Xml")-1, (UA_Byte*)"Default Xml"}; */
24265 
24266 static void
24267 Service_CreateMonitoredItems_single(UA_Server *server, UA_Session *session,
24268  UA_Subscription *sub,
24269  const UA_TimestampsToReturn timestampsToReturn,
24270  const UA_MonitoredItemCreateRequest *request,
24271  UA_MonitoredItemCreateResult *result) {
24272  /* Make an example read to get errors in the itemToMonitor. Allow return
24273  * codes "good" and "uncertain", as well as a list of statuscodes that might
24274  * be repaired inside the data source. */
24275  UA_DataValue v;
24276  UA_DataValue_init(&v);
24277  Service_Read_single(server, session, timestampsToReturn, &request->itemToMonitor, &v);
24278  if(v.hasStatus && (v.status >> 30) > 1 &&
24282  result->statusCode = v.status;
24283  UA_DataValue_deleteMembers(&v);
24284  return;
24285  }
24286  UA_DataValue_deleteMembers(&v);
24287 
24288  /* Check if the encoding is supported */
24289  if(request->itemToMonitor.dataEncoding.name.length > 0 &&
24290  (!UA_String_equal(&binaryEncoding, &request->itemToMonitor.dataEncoding.name) ||
24291  request->itemToMonitor.dataEncoding.namespaceIndex != 0)) {
24293  return;
24294  }
24295 
24296  /* Check if the encoding is set for a value */
24298  request->itemToMonitor.dataEncoding.name.length > 0) {
24300  return;
24301  }
24302 
24303  /* Create the monitoreditem */
24305  if(!newMon) {
24307  return;
24308  }
24309  UA_StatusCode retval = UA_NodeId_copy(&request->itemToMonitor.nodeId,
24310  &newMon->monitoredNodeId);
24311  if(retval != UA_STATUSCODE_GOOD) {
24312  result->statusCode = retval;
24313  MonitoredItem_delete(server, newMon);
24314  return;
24315  }
24316  newMon->subscription = sub;
24317  newMon->attributeID = request->itemToMonitor.attributeId;
24318  newMon->itemId = ++(sub->lastMonitoredItemId);
24319  newMon->timestampsToReturn = timestampsToReturn;
24320  setMonitoredItemSettings(server, newMon, request->monitoringMode,
24321  &request->requestedParameters);
24322  LIST_INSERT_HEAD(&sub->monitoredItems, newMon, listEntry);
24323 
24324  /* Create the first sample */
24326  UA_MoniteredItem_SampleCallback(server, newMon);
24327 
24328  /* Prepare the response */
24329  UA_String_copy(&request->itemToMonitor.indexRange, &newMon->indexRange);
24330  result->revisedSamplingInterval = newMon->samplingInterval;
24331  result->revisedQueueSize = newMon->maxQueueSize;
24332  result->monitoredItemId = newMon->itemId;
24333 }
24334 
24335 void
24336 Service_CreateMonitoredItems(UA_Server *server, UA_Session *session,
24337  const UA_CreateMonitoredItemsRequest *request,
24338  UA_CreateMonitoredItemsResponse *response) {
24339  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24340  "Processing CreateMonitoredItemsRequest");
24341 
24342  /* Check if the timestampstoreturn is valid */
24345  return;
24346  }
24347 
24348  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24349  if(!sub) {
24351  return;
24352  }
24353 
24354  /* Reset the subscription lifetime */
24355  sub->currentLifetimeCount = 0;
24356  if(request->itemsToCreateSize <= 0) {
24358  return;
24359  }
24360 
24361  response->results = UA_Array_new(request->itemsToCreateSize,
24363  if(!response->results) {
24365  return;
24366  }
24367  response->resultsSize = request->itemsToCreateSize;
24368 
24369  for(size_t i = 0; i < request->itemsToCreateSize; ++i)
24370  Service_CreateMonitoredItems_single(server, session, sub, request->timestampsToReturn,
24371  &request->itemsToCreate[i], &response->results[i]);
24372 }
24373 
24374 static void
24375 Service_ModifyMonitoredItems_single(UA_Server *server, UA_Session *session, UA_Subscription *sub,
24376  const UA_MonitoredItemModifyRequest *request,
24377  UA_MonitoredItemModifyResult *result) {
24379  if(!mon) {
24381  return;
24382  }
24383 
24384  setMonitoredItemSettings(server, mon, mon->monitoringMode,
24385  &request->requestedParameters);
24386  result->revisedSamplingInterval = mon->samplingInterval;
24387  result->revisedQueueSize = mon->maxQueueSize;
24388 }
24389 
24390 void Service_ModifyMonitoredItems(UA_Server *server, UA_Session *session,
24391  const UA_ModifyMonitoredItemsRequest *request,
24392  UA_ModifyMonitoredItemsResponse *response) {
24393  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24394  "Processing ModifyMonitoredItemsRequest");
24395 
24396  /* check if the timestampstoreturn is valid */
24399  return;
24400  }
24401 
24402  /* Get the subscription */
24403  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24404  if(!sub) {
24406  return;
24407  }
24408 
24409  /* Reset the subscription lifetime */
24410  sub->currentLifetimeCount = 0;
24411  if(request->itemsToModifySize <= 0) {
24413  return;
24414  }
24415 
24416  response->results = UA_Array_new(request->itemsToModifySize,
24418  if(!response->results) {
24420  return;
24421  }
24422  response->resultsSize = request->itemsToModifySize;
24423 
24424  for(size_t i = 0; i < request->itemsToModifySize; ++i)
24425  Service_ModifyMonitoredItems_single(server, session, sub, &request->itemsToModify[i],
24426  &response->results[i]);
24427 
24428 }
24429 
24430 void Service_SetMonitoringMode(UA_Server *server, UA_Session *session,
24431  const UA_SetMonitoringModeRequest *request,
24432  UA_SetMonitoringModeResponse *response) {
24433  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing SetMonitoringMode");
24434  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24435  if(!sub) {
24437  return;
24438  }
24439 
24440  if(request->monitoredItemIdsSize == 0) {
24442  return;
24443  }
24444 
24446  if(!response->results) {
24448  return;
24449  }
24450  response->resultsSize = request->monitoredItemIdsSize;
24451 
24452  for(size_t i = 0; i < response->resultsSize; ++i) {
24453  UA_MonitoredItem *mon =
24455  if(!mon) {
24457  continue;
24458  }
24459  if(request->monitoringMode == mon->monitoringMode)
24460  continue;
24461  mon->monitoringMode = request->monitoringMode;
24462  if(mon->monitoringMode == UA_MONITORINGMODE_REPORTING)
24463  MonitoredItem_registerSampleJob(server, mon);
24464  else
24465  MonitoredItem_unregisterSampleJob(server, mon);
24466  }
24467 }
24468 
24469 
24470 void
24471 Service_Publish(UA_Server *server, UA_Session *session,
24472  const UA_PublishRequest *request, UA_UInt32 requestId) {
24473  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing PublishRequest");
24475  /* Return an error if the session has no subscription */
24476  if(LIST_EMPTY(&session->serverSubscriptions)) {
24478  goto send_error;
24479  }
24480 
24481  UA_PublishResponseEntry *entry = UA_malloc(sizeof(UA_PublishResponseEntry));
24482  if(!entry) {
24484  goto send_error;
24485  }
24486  entry->requestId = requestId;
24487 
24488  /* Build the response */
24489  UA_PublishResponse *response = &entry->response;
24490  UA_PublishResponse_init(response);
24492  if(request->subscriptionAcknowledgementsSize > 0) {
24495  if(!response->results) {
24496  UA_free(entry);
24498  goto send_error;
24499  }
24500  response->resultsSize = request->subscriptionAcknowledgementsSize;
24501  }
24502 
24503  /* Delete Acknowledged Subscription Messages */
24504  for(size_t i = 0; i < request->subscriptionAcknowledgementsSize; ++i) {
24506  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, ack->subscriptionId);
24507  if(!sub) {
24509  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24510  "Cannot process acknowledgements subscription %u",
24511  ack->subscriptionId);
24512  continue;
24513  }
24514  /* Remove the acked transmission from the retransmission queue */
24516  }
24517 
24518  /* Queue the publish response */
24519  SIMPLEQ_INSERT_TAIL(&session->responseQueue, entry, listEntry);
24520  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Queued a publication message",
24522 
24523  /* Answer immediately to a late subscription */
24524  UA_Subscription *immediate;
24525  LIST_FOREACH(immediate, &session->serverSubscriptions, listEntry) {
24526  if(immediate->state == UA_SUBSCRIPTIONSTATE_LATE) {
24527  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Subscription %u | "
24528  "Response on a late subscription", immediate->subscriptionID,
24530  UA_Subscription_publishCallback(server, immediate);
24531  break;
24532  }
24533  }
24534  return;
24535 
24536  UA_PublishResponse err_response;
24537  send_error:
24538  UA_PublishResponse_init(&err_response);
24539  err_response.responseHeader.requestHandle = request->requestHeader.requestHandle;
24540  err_response.responseHeader.timestamp = UA_DateTime_now();
24541  err_response.responseHeader.serviceResult = retval;
24542  UA_assert(err_response.responseHeader.requestHandle != 0);
24543  UA_SecureChannel_sendBinaryMessage(session->channel, requestId, &err_response,
24545 }
24546 
24547 void
24548 Service_DeleteSubscriptions(UA_Server *server, UA_Session *session,
24549  const UA_DeleteSubscriptionsRequest *request,
24550  UA_DeleteSubscriptionsResponse *response) {
24551  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24552  "Processing DeleteSubscriptionsRequest");
24553 
24554  if(request->subscriptionIdsSize == 0) {
24556  return;
24557  }
24558 
24559  response->results = UA_malloc(sizeof(UA_StatusCode) * request->subscriptionIdsSize);
24560  if(!response->results) {
24562  return;
24563  }
24564  response->resultsSize = request->subscriptionIdsSize;
24565 
24566  for(size_t i = 0; i < request->subscriptionIdsSize; ++i) {
24567  response->results[i] = UA_Session_deleteSubscription(server, session, request->subscriptionIds[i]);
24568  if(response->results[i] == UA_STATUSCODE_GOOD) {
24569  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Subscription %u | "
24570  "Subscription deleted", request->subscriptionIds[i]);
24571  } else {
24572  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Deleting Subscription with Id "
24573  "%u failed with error code 0x%08x", request->subscriptionIds[i],
24574  response->results[i]);
24575  }
24576  }
24577 
24578  /* Send dangling publish responses in a delayed job if the last subscription
24579  was removed */
24580  if(LIST_FIRST(&session->serverSubscriptions))
24581  return;
24582  UA_NodeId *sessionToken = UA_NodeId_new();
24583  if(!sessionToken)
24584  return;
24585  UA_NodeId_copy(&session->authenticationToken, sessionToken);
24586  UA_Server_delayedCallback(server, (UA_ServerCallback)UA_Subscription_answerPublishRequestsNoSubscription,
24587  sessionToken);
24588 }
24589 
24590 void Service_DeleteMonitoredItems(UA_Server *server, UA_Session *session,
24591  const UA_DeleteMonitoredItemsRequest *request,
24592  UA_DeleteMonitoredItemsResponse *response) {
24593  UA_LOG_DEBUG_SESSION(server->config.logger, session,
24594  "Processing DeleteMonitoredItemsRequest");
24595 
24596  if(request->monitoredItemIdsSize == 0) {
24598  return;
24599  }
24600 
24601  /* Get the subscription */
24602  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24603  if(!sub) {
24605  return;
24606  }
24607 
24608  /* Reset the subscription lifetime */
24609  sub->currentLifetimeCount = 0;
24610  response->results = UA_malloc(sizeof(UA_StatusCode) * request->monitoredItemIdsSize);
24611  if(!response->results) {
24613  return;
24614  }
24615  response->resultsSize = request->monitoredItemIdsSize;
24616 
24617  for(size_t i = 0; i < request->monitoredItemIdsSize; ++i)
24618  response->results[i] = UA_Subscription_deleteMonitoredItem(server, sub, request->monitoredItemIds[i]);
24619 }
24620 
24621 void Service_Republish(UA_Server *server, UA_Session *session, const UA_RepublishRequest *request,
24622  UA_RepublishResponse *response) {
24623  UA_LOG_DEBUG_SESSION(server->config.logger, session, "Processing RepublishRequest");
24624  /* get the subscription */
24625  UA_Subscription *sub = UA_Session_getSubscriptionByID(session, request->subscriptionId);
24626  if (!sub) {
24628  return;
24629  }
24630 
24631  /* Reset the subscription lifetime */
24632  sub->currentLifetimeCount = 0;
24633 
24634  /* Find the notification in the retransmission queue */
24636  TAILQ_FOREACH(entry, &sub->retransmissionQueue, listEntry) {
24637  if(entry->message.sequenceNumber == request->retransmitSequenceNumber)
24638  break;
24639  }
24640  if(entry)
24641  response->responseHeader.serviceResult =
24642  UA_NotificationMessage_copy(&entry->message, &response->notificationMessage);
24643  else
24645 }
24646 
24647 #endif /* UA_ENABLE_SUBSCRIPTIONS */
24648 
24649 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/client/ua_client.c" ***********************************/
24650 
24651 /* This Source Code Form is subject to the terms of the Mozilla Public
24652  * License, v. 2.0. If a copy of the MPL was not distributed with this
24653  * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
24654 
24655 
24656 /*********************/
24657 /* Create and Delete */
24658 /*********************/
24659 
24660 static void UA_Client_init(UA_Client* client, UA_ClientConfig config) {
24661  memset(client, 0, sizeof(UA_Client));
24662  client->channel.connection = &client->connection;
24663  client->config = config;
24664 }
24665 
24666 UA_Client * UA_Client_new(UA_ClientConfig config) {
24667  UA_Client *client = (UA_Client*)UA_calloc(1, sizeof(UA_Client));
24668  if(!client)
24669  return NULL;
24670  UA_Client_init(client, config);
24671  return client;
24672 }
24673 
24674 static void UA_Client_deleteMembers(UA_Client* client) {
24675  UA_Client_disconnect(client);
24678  if(client->endpointUrl.data)
24679  UA_String_deleteMembers(&client->endpointUrl);
24680  UA_UserTokenPolicy_deleteMembers(&client->token);
24681  UA_NodeId_deleteMembers(&client->authenticationToken);
24682  if(client->username.data)
24683  UA_String_deleteMembers(&client->username);
24684  if(client->password.data)
24685  UA_String_deleteMembers(&client->password);
24686 #ifdef UA_ENABLE_SUBSCRIPTIONS
24687  UA_Client_NotificationsAckNumber *n, *tmp;
24688  LIST_FOREACH_SAFE(n, &client->pendingNotificationsAcks, listEntry, tmp) {
24689  LIST_REMOVE(n, listEntry);
24690  UA_free(n);
24691  }
24692  UA_Client_Subscription *sub, *tmps;
24693  LIST_FOREACH_SAFE(sub, &client->subscriptions, listEntry, tmps)
24694  UA_Client_Subscriptions_forceDelete(client, sub); /* force local removal */
24695 #endif
24696 }
24697 
24699  UA_Client_deleteMembers(client);
24700  UA_Client_init(client, client->config);
24701 }
24702 
24704  UA_Client_deleteMembers(client);
24705  UA_free(client);
24706 }
24707 
24708 UA_ClientState UA_Client_getState(UA_Client *client) {
24709  if(!client)
24710  return UA_CLIENTSTATE_ERRORED;
24711  return client->state;
24712 }
24713 
24714 /*************************/
24715 /* Manage the Connection */
24716 /*************************/
24717 
24718 #define UA_MINMESSAGESIZE 8192
24719 
24720 static UA_StatusCode
24721 HelAckHandshake(UA_Client *client) {
24722  /* Get a buffer */
24723  UA_ByteString message;
24724  UA_Connection *conn = &client->connection;
24725  UA_StatusCode retval = conn->getSendBuffer(conn, UA_MINMESSAGESIZE, &message);
24726  if(retval != UA_STATUSCODE_GOOD)
24727  return retval;
24728 
24729  /* Prepare the HEL message and encode at offset 8 */
24730  UA_TcpHelloMessage hello;
24731  UA_String_copy(&client->endpointUrl, &hello.endpointUrl); /* must be less than 4096 bytes */
24732  hello.maxChunkCount = conn->localConf.maxChunkCount;
24733  hello.maxMessageSize = conn->localConf.maxMessageSize;
24736  hello.sendBufferSize = conn->localConf.sendBufferSize;
24737 
24738  size_t offset = 8;
24739  retval = UA_TcpHelloMessage_encodeBinary(&hello, &message, &offset);
24740  UA_TcpHelloMessage_deleteMembers(&hello);
24741 
24742  /* Encode the message header at offset 0 */
24743  UA_TcpMessageHeader messageHeader;
24745  messageHeader.messageSize = (UA_UInt32)offset;
24746  offset = 0;
24747  retval |= UA_TcpMessageHeader_encodeBinary(&messageHeader, &message, &offset);
24748  if(retval != UA_STATUSCODE_GOOD) {
24749  conn->releaseSendBuffer(conn, &message);
24750  return retval;
24751  }
24752 
24753  /* Send the HEL message */
24754  message.length = messageHeader.messageSize;
24755  retval = conn->send(conn, &message);
24756  if(retval != UA_STATUSCODE_GOOD) {
24757  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_NETWORK,
24758  "Sending HEL failed");
24759  return retval;
24760  }
24761  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_NETWORK,
24762  "Sent HEL message");
24763 
24764  /* Loop until we have a complete chunk */
24766  UA_Boolean realloced = false;
24767  retval = UA_Connection_receiveChunksBlocking(conn, &reply, &realloced,
24768  client->config.timeout);
24769  if(retval != UA_STATUSCODE_GOOD) {
24770  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_NETWORK,
24771  "Receiving ACK message failed");
24772  return retval;
24773  }
24774 
24775  /* Decode the message */
24776  offset = 0;
24777  UA_TcpAcknowledgeMessage ackMessage;
24778  retval = UA_TcpMessageHeader_decodeBinary(&reply, &offset, &messageHeader);
24779  retval |= UA_TcpAcknowledgeMessage_decodeBinary(&reply, &offset, &ackMessage);
24780 
24781  /* Free the message buffer */
24782  if(!realloced)
24783  conn->releaseRecvBuffer(conn, &reply);
24784  else
24785  UA_ByteString_deleteMembers(&reply);
24786 
24787  /* Store remote connection settings and adjust local configuration to not
24788  exceed the limits */
24789  if(retval == UA_STATUSCODE_GOOD) {
24790  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_NETWORK, "Received ACK message");
24791  conn->remoteConf.maxChunkCount = ackMessage.maxChunkCount; /* may be zero -> unlimited */
24792  conn->remoteConf.maxMessageSize = ackMessage.maxMessageSize; /* may be zero -> unlimited */
24793  conn->remoteConf.protocolVersion = ackMessage.protocolVersion;
24794  conn->remoteConf.sendBufferSize = ackMessage.sendBufferSize;
24795  conn->remoteConf.recvBufferSize = ackMessage.receiveBufferSize;
24801  } else {
24802  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_NETWORK, "Decoding ACK message failed");
24803  }
24804  UA_TcpAcknowledgeMessage_deleteMembers(&ackMessage);
24805 
24806  return retval;
24807 }
24808 
24809 static UA_StatusCode
24810 SecureChannelHandshake(UA_Client *client, UA_Boolean renew) {
24811  /* Check if sc is still valid */
24812  if(renew && client->nextChannelRenewal - UA_DateTime_nowMonotonic() > 0)
24813  return UA_STATUSCODE_GOOD;
24814 
24815  UA_Connection *conn = &client->connection;
24816  if(conn->state != UA_CONNECTION_ESTABLISHED)
24818 
24819  UA_ByteString message;
24820  UA_StatusCode retval = conn->getSendBuffer(conn, conn->remoteConf.recvBufferSize, &message);
24821  if(retval != UA_STATUSCODE_GOOD)
24822  return retval;
24823 
24824  /* Jump over the messageHeader that will be encoded last */
24825  size_t offset = 12;
24826 
24827  /* Encode the Asymmetric Security Header */
24829  UA_AsymmetricAlgorithmSecurityHeader_init(&asymHeader);
24830  asymHeader.securityPolicyUri = UA_STRING("http://opcfoundation.org/UA/SecurityPolicy#None");
24831  retval = UA_AsymmetricAlgorithmSecurityHeader_encodeBinary(&asymHeader, &message, &offset);
24832 
24833  /* Encode the sequence header */
24834  UA_SequenceHeader seqHeader;
24835  seqHeader.sequenceNumber = ++client->channel.sendSequenceNumber;
24836  seqHeader.requestId = ++client->requestId;
24837  retval |= UA_SequenceHeader_encodeBinary(&seqHeader, &message, &offset);
24838 
24839  /* Encode the NodeId of the OpenSecureChannel Service */
24840  UA_NodeId requestType =
24841  UA_NODEID_NUMERIC(0, UA_TYPES[UA_TYPES_OPENSECURECHANNELREQUEST].binaryEncodingId);
24842  retval |= UA_NodeId_encodeBinary(&requestType, &message, &offset);
24843 
24844  /* Encode the OpenSecureChannelRequest */
24845  UA_OpenSecureChannelRequest opnSecRq;
24846  UA_OpenSecureChannelRequest_init(&opnSecRq);
24849  if(renew) {
24851  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24852  "Requesting to renew the SecureChannel");
24853  } else {
24855  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24856  "Requesting to open a SecureChannel");
24857  }
24859  opnSecRq.clientNonce = client->channel.clientNonce;
24860  opnSecRq.requestedLifetime = client->config.secureChannelLifeTime;
24861  retval |= UA_OpenSecureChannelRequest_encodeBinary(&opnSecRq, &message, &offset);
24862 
24863  /* Encode the message header at the beginning */
24864  UA_SecureConversationMessageHeader messageHeader;
24866  messageHeader.messageHeader.messageSize = (UA_UInt32)offset;
24867  if(renew)
24868  messageHeader.secureChannelId = client->channel.securityToken.channelId;
24869  else
24870  messageHeader.secureChannelId = 0;
24871  offset = 0;
24872  retval |= UA_SecureConversationMessageHeader_encodeBinary(&messageHeader, &message, &offset);
24873 
24874  /* Clean up and return if encoding the message failed */
24875  if(retval != UA_STATUSCODE_GOOD) {
24876  client->connection.releaseSendBuffer(&client->connection, &message);
24877  return retval;
24878  }
24879 
24880  /* Send the message */
24881  message.length = messageHeader.messageHeader.messageSize;
24882  retval = conn->send(conn, &message);
24883  if(retval != UA_STATUSCODE_GOOD)
24884  return retval;
24885 
24886  /* Receive the response */
24888  UA_Boolean realloced = false;
24889  retval = UA_Connection_receiveChunksBlocking(conn, &reply, &realloced,
24890  client->config.timeout);
24891  if(retval != UA_STATUSCODE_GOOD) {
24892  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24893  "Receiving OpenSecureChannelResponse failed");
24894  return retval;
24895  }
24896 
24897  /* Decode the header */
24898  offset = 0;
24899  retval = UA_SecureConversationMessageHeader_decodeBinary(&reply, &offset, &messageHeader);
24900  retval |= UA_AsymmetricAlgorithmSecurityHeader_decodeBinary(&reply, &offset, &asymHeader);
24901  retval |= UA_SequenceHeader_decodeBinary(&reply, &offset, &seqHeader);
24902  retval |= UA_NodeId_decodeBinary(&reply, &offset, &requestType);
24903  UA_NodeId expectedRequest =
24904  UA_NODEID_NUMERIC(0, UA_TYPES[UA_TYPES_OPENSECURECHANNELRESPONSE].binaryEncodingId);
24905  if(retval != UA_STATUSCODE_GOOD || !UA_NodeId_equal(&requestType, &expectedRequest)) {
24906  UA_ByteString_deleteMembers(&reply);
24907  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
24908  UA_NodeId_deleteMembers(&requestType);
24909  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT,
24910  "Reply answers the wrong request. Expected OpenSecureChannelResponse.");
24912  }
24913 
24914  /* Save the sequence number from server */
24915  client->channel.receiveSequenceNumber = seqHeader.sequenceNumber;
24916 
24917  /* Decode the response */
24919  retval = UA_OpenSecureChannelResponse_decodeBinary(&reply, &offset, &response);
24920 
24921  /* Free the message */
24922  if(!realloced)
24923  conn->releaseRecvBuffer(conn, &reply);
24924  else
24925  UA_ByteString_deleteMembers(&reply);
24926 
24927  /* Results in either the StatusCode of decoding or the service */
24928  retval |= response.responseHeader.serviceResult;
24929 
24930  if(retval == UA_STATUSCODE_GOOD) {
24931  /* Response.securityToken.revisedLifetime is UInt32 we need to cast it
24932  * to DateTime=Int64 we take 75% of lifetime to start renewing as
24933  * described in standard */
24936 
24937  /* Replace the old nonce */
24938  UA_ChannelSecurityToken_deleteMembers(&client->channel.securityToken);
24939  UA_ChannelSecurityToken_copy(&response.securityToken, &client->channel.securityToken);
24940  UA_ByteString_deleteMembers(&client->channel.serverNonce);
24941  UA_ByteString_copy(&response.serverNonce, &client->channel.serverNonce);
24942 
24943  if(renew)
24944  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24945  "SecureChannel renewed");
24946  else
24947  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24948  "SecureChannel opened");
24949  } else {
24950  if(renew)
24951  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24952  "SecureChannel could not be renewed "
24953  "with error code %s", UA_StatusCode_name(retval));
24954  else
24955  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL,
24956  "SecureChannel could not be opened "
24957  "with error code %s", UA_StatusCode_name(retval));
24958  }
24959 
24960  /* Clean up */
24961  UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader);
24962  UA_OpenSecureChannelResponse_deleteMembers(&response);
24963  return retval;
24964 }
24965 
24966 static UA_StatusCode
24967 ActivateSession(UA_Client *client) {
24968  UA_ActivateSessionRequest request;
24969  UA_ActivateSessionRequest_init(&request);
24970  request.requestHeader.requestHandle = ++client->requestHandle;
24972  request.requestHeader.timeoutHint = 600000;
24973 
24974  //manual ExtensionObject encoding of the identityToken
24976  UA_AnonymousIdentityToken* identityToken = UA_AnonymousIdentityToken_new();
24977  UA_AnonymousIdentityToken_init(identityToken);
24978  UA_String_copy(&client->token.policyId, &identityToken->policyId);
24981  request.userIdentityToken.content.decoded.data = identityToken;
24982  } else {
24983  UA_UserNameIdentityToken* identityToken = UA_UserNameIdentityToken_new();
24984  UA_UserNameIdentityToken_init(identityToken);
24985  UA_String_copy(&client->token.policyId, &identityToken->policyId);
24986  UA_String_copy(&client->username, &identityToken->userName);
24987  UA_String_copy(&client->password, &identityToken->password);
24990  request.userIdentityToken.content.decoded.data = identityToken;
24991  }
24992 
24993  UA_ActivateSessionResponse response;
24996 
24997  if(response.responseHeader.serviceResult) {
24998  UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT,
24999  "ActivateSession failed with error code %s",
25000  UA_StatusCode_name(response.responseHeader.serviceResult));
25001  }
25002 
25003  UA_StatusCode retval = response.responseHeader.serviceResult;
25004  UA_ActivateSessionRequest_deleteMembers(&request);
25005  UA_ActivateSessionResponse_deleteMembers(&response);
25006  return retval;
25007 }
25008 
25009 /* Gets a list of endpoints. Memory is allocated for endpointDescription array */
25010 static UA_StatusCode
25011 GetEndpoints(UA_Client *client, size_t* endpointDescriptionsSize,
25012  UA_EndpointDescription** endpointDescriptions) {
25013  UA_GetEndpointsRequest request;
25014  UA_GetEndpointsRequest_init(&request);
25016  request.requestHeader.timeoutHint = 10000;
25017  // assume the endpointurl outlives the service call
25018  request.endpointUrl = client->endpointUrl;
25019 
25020  UA_GetEndpointsResponse response;
25021  UA_GetEndpointsResponse_init(&response);
25024 
25026  UA_StatusCode retval = response.responseHeader.serviceResult;
25027  UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT,
25028  "GetEndpointRequest failed with error code %s",
25029  UA_StatusCode_name(retval));
25030  UA_GetEndpointsResponse_deleteMembers(&response);
25031  return retval;
25032  }
25033  *endpointDescriptions = response.endpoints;
25034  *endpointDescriptionsSize = response.endpointsSize;
25035  response.endpoints = NULL;
25036  response.endpointsSize = 0;
25037  UA_GetEndpointsResponse_deleteMembers(&response);
25038  return UA_STATUSCODE_GOOD;
25039 }
25040 
25041 static UA_StatusCode
25042 EndpointsHandshake(UA_Client *client) {
25043  UA_EndpointDescription* endpointArray = NULL;
25044  size_t endpointArraySize = 0;
25045  UA_StatusCode retval = GetEndpoints(client, &endpointArraySize, &endpointArray);
25046  if(retval != UA_STATUSCODE_GOOD)
25047  return retval;
25048 
25049  UA_Boolean endpointFound = false;
25050  UA_Boolean tokenFound = false;
25051  UA_String securityNone = UA_STRING("http://opcfoundation.org/UA/SecurityPolicy#None");
25052  UA_String binaryTransport = UA_STRING("http://opcfoundation.org/UA-Profile/"
25053  "Transport/uatcp-uasc-uabinary");
25054 
25055  //TODO: compare endpoint information with client->endpointUri
25056  for(size_t i = 0; i < endpointArraySize; ++i) {
25057  UA_EndpointDescription* endpoint = &endpointArray[i];
25058  /* look out for binary transport endpoints */
25059  /* Note: Siemens returns empty ProfileUrl, we will accept it as binary */
25060  if(endpoint->transportProfileUri.length != 0 &&
25061  !UA_String_equal(&endpoint->transportProfileUri, &binaryTransport))
25062  continue;
25063  /* look out for an endpoint without security */
25064  if(!UA_String_equal(&endpoint->securityPolicyUri, &securityNone))
25065  continue;
25066 
25067  /* endpoint with no security found */
25068  endpointFound = true;
25069 
25070  /* look for a user token policy with an anonymous token */
25071  for(size_t j = 0; j < endpoint->userIdentityTokensSize; ++j) {
25072  UA_UserTokenPolicy* userToken = &endpoint->userIdentityTokens[j];
25073 
25074  /* Usertokens also have a security policy... */
25075  if(userToken->securityPolicyUri.length > 0 &&
25076  !UA_String_equal(&userToken->securityPolicyUri, &securityNone))
25077  continue;
25078 
25079  /* UA_CLIENTAUTHENTICATION_NONE == UA_USERTOKENTYPE_ANONYMOUS
25080  * UA_CLIENTAUTHENTICATION_USERNAME == UA_USERTOKENTYPE_USERNAME
25081  * TODO: Check equivalence for other types when adding the support */
25082  if((int)client->authenticationMethod != (int)userToken->tokenType)
25083  continue;
25084 
25085  /* Endpoint with matching usertokenpolicy found */
25086  tokenFound = true;
25087  UA_UserTokenPolicy_copy(userToken, &client->token);
25088  break;
25089  }
25090  }
25091 
25092  UA_Array_delete(endpointArray, endpointArraySize,
25094 
25095  if(!endpointFound) {
25096  UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT,
25097  "No suitable endpoint found");
25099  } else if(!tokenFound) {
25100  UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT,
25101  "No suitable UserTokenPolicy found for the possible endpoints");
25103  }
25104  return retval;
25105 }
25106 
25107 static UA_StatusCode
25108 SessionHandshake(UA_Client *client) {
25109  UA_CreateSessionRequest request;
25110  UA_CreateSessionRequest_init(&request);
25111 
25113  request.requestHeader.timeoutHint = 10000;
25114  UA_ByteString_copy(&client->channel.clientNonce, &request.clientNonce);
25115  request.requestedSessionTimeout = 1200000;
25117  UA_String_copy(&client->endpointUrl, &request.endpointUrl);
25118 
25119  UA_CreateSessionResponse response;
25120  UA_CreateSessionResponse_init(&response);
25123 
25124  UA_NodeId_copy(&response.authenticationToken, &client->authenticationToken);
25125 
25126  UA_StatusCode retval = response.responseHeader.serviceResult;
25127  UA_CreateSessionRequest_deleteMembers(&request);
25128  UA_CreateSessionResponse_deleteMembers(&response);
25129  return retval;
25130 }
25131 
25132 static UA_StatusCode
25133 CloseSession(UA_Client *client) {
25134  UA_CloseSessionRequest request;
25135  UA_CloseSessionRequest_init(&request);
25136 
25138  request.requestHeader.timeoutHint = 10000;
25139  request.deleteSubscriptions = true;
25140  UA_CloseSessionResponse response;
25143 
25144  UA_StatusCode retval = response.responseHeader.serviceResult;
25145  UA_CloseSessionRequest_deleteMembers(&request);
25146  UA_CloseSessionResponse_deleteMembers(&response);
25147  return retval;
25148 }
25149 
25150 static UA_StatusCode
25151 CloseSecureChannel(UA_Client *client) {
25152  UA_SecureChannel *channel = &client->channel;
25154  UA_CloseSecureChannelRequest_init(&request);
25155  request.requestHeader.requestHandle = ++client->requestHandle;
25157  request.requestHeader.timeoutHint = 10000;
25158  UA_NodeId_copy(&client->authenticationToken,
25160 
25163  msgHeader.secureChannelId = channel->securityToken.channelId;
25164 
25166  symHeader.tokenId = channel->securityToken.tokenId;
25167 
25168  UA_SequenceHeader seqHeader;
25169  seqHeader.sequenceNumber = ++channel->sendSequenceNumber;
25170  seqHeader.requestId = ++client->requestId;
25171 
25172  UA_NodeId typeId =
25173  UA_NODEID_NUMERIC(0, UA_TYPES[UA_TYPES_CLOSESECURECHANNELREQUEST].binaryEncodingId);
25174 
25175  UA_ByteString message;
25176  UA_Connection *conn = &client->connection;
25177  UA_StatusCode retval = conn->getSendBuffer(conn, conn->remoteConf.recvBufferSize, &message);
25178  if(retval != UA_STATUSCODE_GOOD){
25179  UA_CloseSecureChannelRequest_deleteMembers(&request);
25180  return retval;
25181  }
25182 
25183  size_t offset = 12;
25184  retval |= UA_SymmetricAlgorithmSecurityHeader_encodeBinary(&symHeader, &message, &offset);
25185  retval |= UA_SequenceHeader_encodeBinary(&seqHeader, &message, &offset);
25186  retval |= UA_NodeId_encodeBinary(&typeId, &message, &offset);
25188  NULL, NULL, &message, &offset);
25189 
25190  msgHeader.messageHeader.messageSize = (UA_UInt32)offset;
25191  offset = 0;
25192  retval |= UA_SecureConversationMessageHeader_encodeBinary(&msgHeader, &message, &offset);
25193 
25194  if(retval == UA_STATUSCODE_GOOD) {
25195  message.length = msgHeader.messageHeader.messageSize;
25196  retval = conn->send(conn, &message);
25197  } else {
25198  conn->releaseSendBuffer(conn, &message);
25199  }
25200  conn->close(conn);
25201  UA_CloseSecureChannelRequest_deleteMembers(&request);
25202  return retval;
25203 }
25204 
25206 UA_Client_getEndpoints(UA_Client *client, const char *serverUrl,
25207  size_t* endpointDescriptionsSize,
25208  UA_EndpointDescription** endpointDescriptions) {
25209  if(client->state == UA_CLIENTSTATE_CONNECTED)
25210  return UA_STATUSCODE_GOOD;
25211  if(client->state == UA_CLIENTSTATE_ERRORED)
25212  UA_Client_reset(client);
25213 
25214 
25216  client->connection =
25217  client->config.connectionFunc(UA_ConnectionConfig_standard, serverUrl,
25218  client->config.logger);
25219  if(client->connection.state != UA_CONNECTION_OPENING) {
25221  goto cleanup;
25222  }
25223 
25224  client->endpointUrl = UA_STRING_ALLOC(serverUrl);
25225  if(!client->endpointUrl.data) {
25227  goto cleanup;
25228  }
25229 
25230  client->connection.localConf = client->config.localConnectionConfig;
25231  retval = HelAckHandshake(client);
25232  if(retval == UA_STATUSCODE_GOOD)
25233  retval = SecureChannelHandshake(client, false);
25234  if(retval == UA_STATUSCODE_GOOD)
25235  retval = GetEndpoints(client, endpointDescriptionsSize, endpointDescriptions);
25236 
25237  /* always cleanup */
25238  cleanup:
25239  UA_Client_disconnect(client);
25240  UA_Client_reset(client);
25241  return retval;
25242 }
25243 
25245 UA_Client_connect_username(UA_Client *client, const char *endpointUrl,
25246  const char *username, const char *password){
25248  client->username = UA_STRING_ALLOC(username);
25249  client->password = UA_STRING_ALLOC(password);
25250  return UA_Client_connect(client, endpointUrl);
25251 }
25252 
25253 
25255 UA_Client_connect(UA_Client *client, const char *endpointUrl) {
25256  if(client->state == UA_CLIENTSTATE_CONNECTED)
25257  return UA_STATUSCODE_GOOD;
25258  if(client->state == UA_CLIENTSTATE_ERRORED) {
25259  UA_Client_reset(client);
25260  }
25261 
25263  client->connection =
25264  client->config.connectionFunc(UA_ConnectionConfig_standard,
25265  endpointUrl, client->config.logger);
25266  if(client->connection.state != UA_CONNECTION_OPENING) {
25268  goto cleanup;
25269  }
25270 
25271  client->endpointUrl = UA_STRING_ALLOC(endpointUrl);
25272  if(!client->endpointUrl.data) {
25274  goto cleanup;
25275  }
25276 
25277  client->connection.localConf = client->config.localConnectionConfig;
25278  retval = HelAckHandshake(client);
25279  if(retval == UA_STATUSCODE_GOOD)
25280  retval = SecureChannelHandshake(client, false);
25281  if(retval == UA_STATUSCODE_GOOD)
25282  retval = EndpointsHandshake(client);
25283  if(retval == UA_STATUSCODE_GOOD)
25284  retval = SessionHandshake(client);
25285  if(retval == UA_STATUSCODE_GOOD)
25286  retval = ActivateSession(client);
25287  if(retval == UA_STATUSCODE_GOOD) {
25289  client->state = UA_CLIENTSTATE_CONNECTED;
25290  } else {
25291  goto cleanup;
25292  }
25293  return retval;
25294 
25295  cleanup:
25296  UA_Client_reset(client);
25297  return retval;
25298 }
25299 
25301  if(client->state == UA_CLIENTSTATE_READY)
25304  /* Is a session established? */
25305  if(client->connection.state == UA_CONNECTION_ESTABLISHED &&
25306  !UA_NodeId_equal(&client->authenticationToken, &UA_NODEID_NULL))
25307  retval = CloseSession(client);
25308  /* Is a secure channel established? */
25310  retval |= CloseSecureChannel(client);
25311  return retval;
25312 }
25313 
25315  UA_StatusCode retval = SecureChannelHandshake(client, true);
25316  if(retval == UA_STATUSCODE_GOOD)
25317  client->state = UA_CLIENTSTATE_CONNECTED;
25318  return retval;
25319 }
25320 
25321 /****************/
25322 /* Raw Services */
25323 /****************/
25324 
25329  void *response;
25331 };
25332 
25333 static void
25334 processServiceResponse(struct ResponseDescription *rd, UA_SecureChannel *channel,
25335  UA_MessageType messageType, UA_UInt32 requestId,
25336  UA_ByteString *message) {
25338  const UA_NodeId expectedNodeId =
25339  UA_NODEID_NUMERIC(0, rd->responseType->binaryEncodingId);
25340  const UA_NodeId serviceFaultNodeId =
25341  UA_NODEID_NUMERIC(0, UA_TYPES[UA_TYPES_SERVICEFAULT].binaryEncodingId);
25342 
25343  UA_ResponseHeader *respHeader = (UA_ResponseHeader*)rd->response;
25344  rd->processed = true;
25345 
25346  if(messageType == UA_MESSAGETYPE_ERR) {
25347  UA_TcpErrorMessage *msg = (UA_TcpErrorMessage*)message;
25348  UA_LOG_ERROR(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25349  "Server replied with an error message: %s %.*s",
25350  UA_StatusCode_name(msg->error), msg->reason.length, msg->reason.data);
25351  retval = msg->error;
25352  goto finish;
25353  } else if(messageType != UA_MESSAGETYPE_MSG) {
25354  UA_LOG_ERROR(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25355  "Server replied with the wrong message type");
25357  goto finish;
25358  }
25359 
25360  /* Check that the request id matches */
25361  /* Todo: we need to demux async responses since a publish responses may come
25362  at any time */
25363  if(requestId != rd->requestId) {
25364  UA_LOG_ERROR(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25365  "Reply answers the wrong requestId. "
25366  "Async services are not yet implemented.");
25368  goto finish;
25369  }
25370 
25371  /* Check that the response type matches */
25372  size_t offset = 0;
25373  UA_NodeId responseId;
25374  retval = UA_NodeId_decodeBinary(message, &offset, &responseId);
25375  if(retval != UA_STATUSCODE_GOOD)
25376  goto finish;
25377  if(!UA_NodeId_equal(&responseId, &expectedNodeId)) {
25378  if(UA_NodeId_equal(&responseId, &serviceFaultNodeId)) {
25379  /* Take the statuscode from the servicefault */
25380  retval = UA_decodeBinary(message, &offset, rd->response,
25382  } else {
25383  UA_LOG_ERROR(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25384  "Reply answers the wrong request. Expected ns=%i,i=%i."
25385  "But retrieved ns=%i,i=%i", expectedNodeId.namespaceIndex,
25386  expectedNodeId.identifier.numeric, responseId.namespaceIndex,
25387  responseId.identifier.numeric);
25388  UA_NodeId_deleteMembers(&responseId);
25390  }
25391  goto finish;
25392  }
25393 
25394  /* Decode the response */
25395  retval = UA_decodeBinary(message, &offset, rd->response, rd->responseType);
25396 
25397  finish:
25398  if(retval == UA_STATUSCODE_GOOD) {
25399  UA_LOG_DEBUG(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25400  "Received a response of type %i", responseId.identifier.numeric);
25401  } else {
25404  UA_LOG_INFO(rd->client->config.logger, UA_LOGCATEGORY_CLIENT,
25405  "Error receiving the response");
25406  respHeader->serviceResult = retval;
25407  }
25408 }
25409 
25410 void
25411 __UA_Client_Service(UA_Client *client, const void *request, const UA_DataType *requestType,
25412  void *response, const UA_DataType *responseType) {
25413  UA_init(response, responseType);
25414  UA_ResponseHeader *respHeader = (UA_ResponseHeader*)response;
25415 
25416  /* Make sure we have a valid session */
25418  if(retval != UA_STATUSCODE_GOOD) {
25419  respHeader->serviceResult = retval;
25420  client->state = UA_CLIENTSTATE_ERRORED;
25421  return;
25422  }
25423 
25424  /* Adjusting the request header. The const attribute is violated, but we
25425  * only touch the following members: */
25426  UA_RequestHeader *rr = (UA_RequestHeader*)(uintptr_t)request;
25427  rr->authenticationToken = client->authenticationToken; /* cleaned up at the end */
25428  rr->timestamp = UA_DateTime_now();
25429  rr->requestHandle = ++client->requestHandle;
25430 
25431  /* Send the request */
25432  UA_UInt32 requestId = ++client->requestId;
25433  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT,
25434  "Sending a request of type %i", requestType->typeId.identifier.numeric);
25435  retval = UA_SecureChannel_sendBinaryMessage(&client->channel, requestId, rr, requestType);
25436  if(retval != UA_STATUSCODE_GOOD) {
25439  else
25440  respHeader->serviceResult = retval;
25441  client->state = UA_CLIENTSTATE_FAULTED;
25442  UA_NodeId_init(&rr->authenticationToken);
25443  return;
25444  }
25445 
25446  /* Prepare the response and the structure we give into processServiceResponse */
25447  UA_init(response, responseType);
25448  struct ResponseDescription rd = {client, false, requestId, response, responseType};
25449 
25450  /* Retrieve the response */
25451  UA_DateTime maxDate = UA_DateTime_nowMonotonic() + (client->config.timeout * UA_MSEC_TO_DATETIME);
25452  do {
25453  /* Retrieve complete chunks */
25455  UA_Boolean realloced = false;
25457  if(now < maxDate) {
25458  UA_UInt32 timeout = (UA_UInt32)((maxDate - now) / UA_MSEC_TO_DATETIME);
25459  retval = UA_Connection_receiveChunksBlocking(&client->connection, &reply, &realloced, timeout);
25460  } else {
25462  }
25463  if(retval != UA_STATUSCODE_GOOD) {
25464  respHeader->serviceResult = retval;
25465  break;
25466  }
25467  /* ProcessChunks and call processServiceResponse for complete messages */
25468  UA_SecureChannel_processChunks(&client->channel, &reply,
25469  (UA_ProcessMessageCallback*)processServiceResponse, &rd);
25470  /* Free the received buffer */
25471  if(!realloced)
25472  client->connection.releaseRecvBuffer(&client->connection, &reply);
25473  else
25474  UA_ByteString_deleteMembers(&reply);
25475  } while(!rd.processed);
25476 
25477  /* Clean up the authentication token */
25478  UA_NodeId_init(&rr->authenticationToken);
25479 }
25480 
25481 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/client/ua_client_highlevel.c" ***********************************/
25482 
25483 /* This Source Code Form is subject to the terms of the Mozilla Public
25484 * License, v. 2.0. If a copy of the MPL was not distributed with this
25485 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
25486 
25487 
25490  UA_UInt16 *namespaceIndex) {
25491  UA_ReadRequest request;
25492  UA_ReadRequest_init(&request);
25493  UA_ReadValueId id;
25494  UA_ReadValueId_init(&id);
25495  id.attributeId = UA_ATTRIBUTEID_VALUE;
25496  id.nodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_NAMESPACEARRAY);
25497  request.nodesToRead = &id;
25498  request.nodesToReadSize = 1;
25499 
25500  UA_ReadResponse response = UA_Client_Service_read(client, request);
25501 
25504  retval = response.responseHeader.serviceResult;
25505  else if(response.resultsSize != 1 || !response.results[0].hasValue)
25507  else if(response.results[0].value.type != &UA_TYPES[UA_TYPES_STRING])
25509 
25510  if(retval != UA_STATUSCODE_GOOD) {
25511  UA_ReadResponse_deleteMembers(&response);
25512  return retval;
25513  }
25514 
25515  retval = UA_STATUSCODE_BADNOTFOUND;
25516  UA_String *ns = response.results[0].value.data;
25517  for(size_t i = 0; i < response.results[0].value.arrayLength; ++i){
25518  if(UA_String_equal(namespaceUri, &ns[i])) {
25519  *namespaceIndex = (UA_UInt16)i;
25520  retval = UA_STATUSCODE_GOOD;
25521  break;
25522  }
25523  }
25524 
25525  UA_ReadResponse_deleteMembers(&response);
25526  return retval;
25527 }
25528 
25531  UA_NodeIteratorCallback callback, void *handle) {
25532  UA_BrowseRequest bReq;
25533  UA_BrowseRequest_init(&bReq);
25535  bReq.nodesToBrowse = UA_BrowseDescription_new();
25536  bReq.nodesToBrowseSize = 1;
25537  UA_NodeId_copy(&parentNodeId, &bReq.nodesToBrowse[0].nodeId);
25538  bReq.nodesToBrowse[0].resultMask = UA_BROWSERESULTMASK_ALL; //return everything
25540 
25541  UA_BrowseResponse bResp = UA_Client_Service_browse(client, bReq);
25542 
25545  for (size_t i = 0; i < bResp.resultsSize; ++i) {
25546  for (size_t j = 0; j < bResp.results[i].referencesSize; ++j) {
25547  UA_ReferenceDescription *ref = &(bResp.results[i].references[j]);
25548  retval |= callback(ref->nodeId.nodeId, !ref->isForward,
25549  ref->referenceTypeId, handle);
25550  }
25551  }
25552  }
25553  else
25554  retval = bResp.responseHeader.serviceResult;
25555 
25556 
25557  UA_BrowseRequest_deleteMembers(&bReq);
25558  UA_BrowseResponse_deleteMembers(&bResp);
25559 
25560  return retval;
25561 }
25562 
25563 /*******************/
25564 /* Node Management */
25565 /*******************/
25566 
25568 UA_Client_addReference(UA_Client *client, const UA_NodeId sourceNodeId,
25569  const UA_NodeId referenceTypeId, UA_Boolean isForward,
25570  const UA_String targetServerUri,
25571  const UA_ExpandedNodeId targetNodeId,
25572  UA_NodeClass targetNodeClass) {
25573  UA_AddReferencesItem item;
25574  UA_AddReferencesItem_init(&item);
25575  item.sourceNodeId = sourceNodeId;
25576  item.referenceTypeId = referenceTypeId;
25577  item.isForward = isForward;
25578  item.targetServerUri = targetServerUri;
25579  item.targetNodeId = targetNodeId;
25580  item.targetNodeClass = targetNodeClass;
25581  UA_AddReferencesRequest request;
25582  UA_AddReferencesRequest_init(&request);
25583  request.referencesToAdd = &item;
25584  request.referencesToAddSize = 1;
25585  UA_AddReferencesResponse response = UA_Client_Service_addReferences(client, request);
25586  UA_StatusCode retval = response.responseHeader.serviceResult;
25587  if(retval != UA_STATUSCODE_GOOD) {
25588  UA_AddReferencesResponse_deleteMembers(&response);
25589  return retval;
25590  }
25591  if(response.resultsSize != 1) {
25592  UA_AddReferencesResponse_deleteMembers(&response);
25594  }
25595  retval = response.results[0];
25596  UA_AddReferencesResponse_deleteMembers(&response);
25597  return retval;
25598 }
25599 
25601 UA_Client_deleteReference(UA_Client *client, const UA_NodeId sourceNodeId,
25602  const UA_NodeId referenceTypeId, UA_Boolean isForward,
25603  const UA_ExpandedNodeId targetNodeId,
25604  UA_Boolean deleteBidirectional) {
25606  UA_DeleteReferencesItem_init(&item);
25607  item.sourceNodeId = sourceNodeId;
25608  item.referenceTypeId = referenceTypeId;
25609  item.isForward = isForward;
25610  item.targetNodeId = targetNodeId;
25611  item.deleteBidirectional = deleteBidirectional;
25613  UA_DeleteReferencesRequest_init(&request);
25614  request.referencesToDelete = &item;
25615  request.referencesToDeleteSize = 1;
25616  UA_DeleteReferencesResponse response = UA_Client_Service_deleteReferences(client, request);
25617  UA_StatusCode retval = response.responseHeader.serviceResult;
25618  if(retval != UA_STATUSCODE_GOOD) {
25619  UA_DeleteReferencesResponse_deleteMembers(&response);
25620  return retval;
25621  }
25622  if(response.resultsSize != 1) {
25623  UA_DeleteReferencesResponse_deleteMembers(&response);
25625  }
25626  retval = response.results[0];
25627  UA_DeleteReferencesResponse_deleteMembers(&response);
25628  return retval;
25629 }
25630 
25633  UA_Boolean deleteTargetReferences) {
25634  UA_DeleteNodesItem item;
25635  UA_DeleteNodesItem_init(&item);
25636  item.nodeId = nodeId;
25637  item.deleteTargetReferences = deleteTargetReferences;
25638  UA_DeleteNodesRequest request;
25639  UA_DeleteNodesRequest_init(&request);
25640  request.nodesToDelete = &item;
25641  request.nodesToDeleteSize = 1;
25642  UA_DeleteNodesResponse response = UA_Client_Service_deleteNodes(client, request);
25643  UA_StatusCode retval = response.responseHeader.serviceResult;
25644  if(retval != UA_STATUSCODE_GOOD) {
25645  UA_DeleteNodesResponse_deleteMembers(&response);
25646  return retval;
25647  }
25648  if(response.resultsSize != 1) {
25649  UA_DeleteNodesResponse_deleteMembers(&response);
25651  }
25652  retval = response.results[0];
25653  UA_DeleteNodesResponse_deleteMembers(&response);
25654  return retval;
25655 }
25656 
25658 __UA_Client_addNode(UA_Client *client, const UA_NodeClass nodeClass,
25659  const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId,
25660  const UA_NodeId referenceTypeId, const UA_QualifiedName browseName,
25661  const UA_NodeId typeDefinition, const UA_NodeAttributes *attr,
25662  const UA_DataType *attributeType, UA_NodeId *outNewNodeId) {
25664  UA_AddNodesRequest request;
25665  UA_AddNodesRequest_init(&request);
25666  UA_AddNodesItem item;
25667  UA_AddNodesItem_init(&item);
25668  item.parentNodeId.nodeId = parentNodeId;
25669  item.referenceTypeId = referenceTypeId;
25670  item.requestedNewNodeId.nodeId = requestedNewNodeId;
25671  item.browseName = browseName;
25672  item.nodeClass = nodeClass;
25673  item.typeDefinition.nodeId = typeDefinition;
25675  item.nodeAttributes.content.decoded.type = attributeType;
25676  item.nodeAttributes.content.decoded.data = (void*)(uintptr_t)attr; // hack. is not written into.
25677  request.nodesToAdd = &item;
25678  request.nodesToAddSize = 1;
25679  UA_AddNodesResponse response = UA_Client_Service_addNodes(client, request);
25681  retval = response.responseHeader.serviceResult;
25682  UA_AddNodesResponse_deleteMembers(&response);
25683  return retval;
25684  }
25685  if(response.resultsSize != 1) {
25686  UA_AddNodesResponse_deleteMembers(&response);
25688  }
25689  if(outNewNodeId && response.results[0].statusCode == UA_STATUSCODE_GOOD) {
25690  *outNewNodeId = response.results[0].addedNodeId;
25691  UA_NodeId_init(&response.results[0].addedNodeId);
25692  }
25693  retval = response.results[0].statusCode;
25694  UA_AddNodesResponse_deleteMembers(&response);
25695  return retval;
25696 }
25697 
25698 /********/
25699 /* Call */
25700 /********/
25701 
25702 #ifdef UA_ENABLE_METHODCALLS
25703 
25705 UA_Client_call(UA_Client *client, const UA_NodeId objectId,
25706  const UA_NodeId methodId, size_t inputSize,
25707  const UA_Variant *input, size_t *outputSize,
25708  UA_Variant **output) {
25709  /* Set up the request */
25710  UA_CallRequest request;
25711  UA_CallRequest_init(&request);
25712  UA_CallMethodRequest item;
25713  UA_CallMethodRequest_init(&item);
25714  item.methodId = methodId;
25715  item.objectId = objectId;
25716  item.inputArguments = (void*)(uintptr_t)input; // cast const...
25717  item.inputArgumentsSize = inputSize;
25718  request.methodsToCall = &item;
25719  request.methodsToCallSize = 1;
25720 
25721  /* Call the service */
25722  UA_CallResponse response = UA_Client_Service_call(client, request);
25723  UA_StatusCode retval = response.responseHeader.serviceResult;
25724  if(retval == UA_STATUSCODE_GOOD) {
25725  if(response.resultsSize == 1)
25726  retval = response.results[0].statusCode;
25727  else
25729  }
25730  if(retval != UA_STATUSCODE_GOOD) {
25731  UA_CallResponse_deleteMembers(&response);
25732  return retval;
25733  }
25734 
25735  /* Move the output arguments */
25736  if(output != NULL && outputSize != NULL) {
25737  *output = response.results[0].outputArguments;
25738  *outputSize = response.results[0].outputArgumentsSize;
25739  response.results[0].outputArguments = NULL;
25740  response.results[0].outputArgumentsSize = 0;
25741  }
25742  UA_CallResponse_deleteMembers(&response);
25743  return retval;
25744 }
25745 
25746 #endif
25747 
25748 /********************/
25749 /* Write Attributes */
25750 /********************/
25751 
25754  UA_AttributeId attributeId, const void *in,
25755  const UA_DataType *inDataType) {
25756  if(!in)
25758 
25759  UA_WriteValue wValue;
25760  UA_WriteValue_init(&wValue);
25761  wValue.nodeId = *nodeId;
25762  wValue.attributeId = attributeId;
25763  if(attributeId == UA_ATTRIBUTEID_VALUE)
25764  wValue.value.value = *(const UA_Variant*)in;
25765  else
25766  /* hack. is never written into. */
25767  UA_Variant_setScalar(&wValue.value.value, (void*)(uintptr_t)in, inDataType);
25768  wValue.value.hasValue = true;
25769  UA_WriteRequest wReq;
25770  UA_WriteRequest_init(&wReq);
25771  wReq.nodesToWrite = &wValue;
25772  wReq.nodesToWriteSize = 1;
25773 
25774  UA_WriteResponse wResp = UA_Client_Service_write(client, wReq);
25775 
25777  if(retval == UA_STATUSCODE_GOOD) {
25778  if(wResp.resultsSize == 1)
25779  retval = wResp.results[0];
25780  else
25782  }
25783 
25784  UA_WriteResponse_deleteMembers(&wResp);
25785  return retval;
25786 }
25787 
25790  const UA_UInt32 *newArrayDimensions,
25791  size_t newArrayDimensionsSize) {
25792  if(!newArrayDimensions)
25794 
25795  UA_WriteValue wValue;
25796  UA_WriteValue_init(&wValue);
25797  wValue.nodeId = nodeId;
25799  UA_Variant_setArray(&wValue.value.value, (void*)(uintptr_t)newArrayDimensions,
25800  newArrayDimensionsSize, &UA_TYPES[UA_TYPES_UINT32]);
25801  wValue.value.hasValue = true;
25802  UA_WriteRequest wReq;
25803  UA_WriteRequest_init(&wReq);
25804  wReq.nodesToWrite = &wValue;
25805  wReq.nodesToWriteSize = 1;
25806 
25807  UA_WriteResponse wResp = UA_Client_Service_write(client, wReq);
25808 
25810  if(retval == UA_STATUSCODE_GOOD) {
25811  if(wResp.resultsSize == 1)
25812  retval = wResp.results[0];
25813  else
25815  }
25816  UA_WriteResponse_deleteMembers(&wResp);
25817  return retval;
25818 }
25819 
25820 /*******************/
25821 /* Read Attributes */
25822 /*******************/
25823 
25826  UA_AttributeId attributeId, void *out,
25827  const UA_DataType *outDataType) {
25828  UA_ReadValueId item;
25829  UA_ReadValueId_init(&item);
25830  item.nodeId = *nodeId;
25831  item.attributeId = attributeId;
25832  UA_ReadRequest request;
25833  UA_ReadRequest_init(&request);
25834  request.nodesToRead = &item;
25835  request.nodesToReadSize = 1;
25836  UA_ReadResponse response = UA_Client_Service_read(client, request);
25837  UA_StatusCode retval = response.responseHeader.serviceResult;
25838  if(retval == UA_STATUSCODE_GOOD) {
25839  if(response.resultsSize == 1)
25840  retval = response.results[0].status;
25841  else
25843  }
25844  if(retval != UA_STATUSCODE_GOOD) {
25845  UA_ReadResponse_deleteMembers(&response);
25846  return retval;
25847  }
25848 
25849  /* Set the StatusCode */
25850  UA_DataValue *res = response.results;
25851  if(res->hasStatus)
25852  retval = res->status;
25853 
25854  /* Return early of no value is given */
25855  if(!res->hasValue) {
25856  if(retval == UA_STATUSCODE_GOOD)
25858  UA_ReadResponse_deleteMembers(&response);
25859  return retval;
25860  }
25861 
25862  /* Copy value into out */
25863  if(attributeId == UA_ATTRIBUTEID_VALUE) {
25864  memcpy(out, &res->value, sizeof(UA_Variant));
25865  UA_Variant_init(&res->value);
25866  } else if(attributeId == UA_ATTRIBUTEID_NODECLASS) {
25867  memcpy(out, (UA_NodeClass*)res->value.data, sizeof(UA_NodeClass));
25868  } else if(UA_Variant_isScalar(&res->value) &&
25869  res->value.type == outDataType) {
25870  memcpy(out, res->value.data, res->value.type->memSize);
25871  UA_free(res->value.data);
25872  res->value.data = NULL;
25873  } else {
25875  }
25876 
25877  UA_ReadResponse_deleteMembers(&response);
25878  return retval;
25879 }
25880 
25883  UA_UInt32 **outArrayDimensions,
25884  size_t *outArrayDimensionsSize) {
25885  UA_ReadValueId item;
25886  UA_ReadValueId_init(&item);
25887  item.nodeId = nodeId;
25889  UA_ReadRequest request;
25890  UA_ReadRequest_init(&request);
25891  request.nodesToRead = &item;
25892  request.nodesToReadSize = 1;
25893  UA_ReadResponse response = UA_Client_Service_read(client, request);
25894  UA_StatusCode retval = response.responseHeader.serviceResult;
25895  if(retval == UA_STATUSCODE_GOOD) {
25896  if(response.resultsSize == 1)
25897  retval = response.results[0].status;
25898  else
25900  }
25901  if(retval != UA_STATUSCODE_GOOD)
25902  goto cleanup;
25903 
25904  UA_DataValue *res = response.results;
25905  if(res->hasStatus != UA_STATUSCODE_GOOD)
25906  retval = res->hasStatus;
25907  else if(!res->hasValue || UA_Variant_isScalar(&res->value))
25909  if(retval != UA_STATUSCODE_GOOD)
25910  goto cleanup;
25911 
25912  if(UA_Variant_isScalar(&res->value) ||
25913  res->value.type != &UA_TYPES[UA_TYPES_UINT32]) {
25915  goto cleanup;
25916  }
25917 
25918  /* Move data out of the results structure instead of copying */
25919  *outArrayDimensions = res->value.data;
25920  *outArrayDimensionsSize = res->value.arrayLength;
25921  res->value.data = NULL;
25922  res->value.arrayLength = 0;
25923 
25924  cleanup:
25925  UA_ReadResponse_deleteMembers(&response);
25926  return retval;
25927 
25928 }
25929 
25930 /*********************************** amalgamated original file "/home/iosb/sw/open62541/src/client/ua_client_highlevel_subscriptions.c" ***********************************/
25931 
25932 /* This Source Code Form is subject to the terms of the Mozilla Public
25933 * License, v. 2.0. If a copy of the MPL was not distributed with this
25934 * file, You can obtain one at http://mozilla.org/MPL/2.0/.*/
25935 
25936 
25937 #ifdef UA_ENABLE_SUBSCRIPTIONS /* conditional compilation */
25938 
25940 UA_Client_Subscriptions_new(UA_Client *client, UA_SubscriptionSettings settings,
25941  UA_UInt32 *newSubscriptionId) {
25943  UA_CreateSubscriptionRequest_init(&request);
25944  request.requestedPublishingInterval = settings.requestedPublishingInterval;
25945  request.requestedLifetimeCount = settings.requestedLifetimeCount;
25946  request.requestedMaxKeepAliveCount = settings.requestedMaxKeepAliveCount;
25947  request.maxNotificationsPerPublish = settings.maxNotificationsPerPublish;
25948  request.publishingEnabled = settings.publishingEnabled;
25949  request.priority = settings.priority;
25950 
25951  UA_CreateSubscriptionResponse response = UA_Client_Service_createSubscription(client, request);
25952  UA_StatusCode retval = response.responseHeader.serviceResult;
25953  if(retval != UA_STATUSCODE_GOOD)
25954  goto cleanup;
25955 
25956  UA_Client_Subscription *newSub = UA_malloc(sizeof(UA_Client_Subscription));
25957  if(!newSub) {
25959  goto cleanup;
25960  }
25961 
25962  LIST_INIT(&newSub->monitoredItems);
25963  newSub->lifeTime = response.revisedLifetimeCount;
25964  newSub->keepAliveCount = response.revisedMaxKeepAliveCount;
25965  newSub->publishingInterval = response.revisedPublishingInterval;
25966  newSub->subscriptionID = response.subscriptionId;
25967  newSub->notificationsPerPublish = request.maxNotificationsPerPublish;
25968  newSub->priority = request.priority;
25969  LIST_INSERT_HEAD(&client->subscriptions, newSub, listEntry);
25970 
25971  if(newSubscriptionId)
25972  *newSubscriptionId = newSub->subscriptionID;
25973 
25974  cleanup:
25975  UA_CreateSubscriptionResponse_deleteMembers(&response);
25976  return retval;
25977 }
25978 
25979 /* remove the subscription remotely */
25981 UA_Client_Subscriptions_remove(UA_Client *client, UA_UInt32 subscriptionId) {
25982  UA_Client_Subscription *sub;
25983  LIST_FOREACH(sub, &client->subscriptions, listEntry) {
25984  if(sub->subscriptionID == subscriptionId)
25985  break;
25986  }
25987  if(!sub)
25989 
25991  UA_Client_MonitoredItem *mon, *tmpmon;
25992  LIST_FOREACH_SAFE(mon, &sub->monitoredItems, listEntry, tmpmon) {
25993  retval =
25994  UA_Client_Subscriptions_removeMonitoredItem(client, sub->subscriptionID,
25995  mon->monitoredItemId);
25996  if(retval != UA_STATUSCODE_GOOD)
25997  return retval;
25998  }
25999 
26000  /* remove the subscription remotely */
26002  UA_DeleteSubscriptionsRequest_init(&request);
26003  request.subscriptionIdsSize = 1;
26004  request.subscriptionIds = &sub->subscriptionID;
26005  UA_DeleteSubscriptionsResponse response = UA_Client_Service_deleteSubscriptions(client, request);
26006  retval = response.responseHeader.serviceResult;
26007  if(retval == UA_STATUSCODE_GOOD && response.resultsSize > 0)
26008  retval = response.results[0];
26009  UA_DeleteSubscriptionsResponse_deleteMembers(&response);
26010 
26011  if(retval != UA_STATUSCODE_GOOD && retval != UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID) {
26012  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_CLIENT,
26013  "Could not remove subscription %u with error code %s",
26014  sub->subscriptionID, UA_StatusCode_name(retval));
26015  return retval;
26016  }
26017 
26018  UA_Client_Subscriptions_forceDelete(client, sub);
26019  return UA_STATUSCODE_GOOD;
26020 }
26021 
26022 void
26023 UA_Client_Subscriptions_forceDelete(UA_Client *client,
26024  UA_Client_Subscription *sub) {
26025  UA_Client_MonitoredItem *mon, *mon_tmp;
26026  LIST_FOREACH_SAFE(mon, &sub->monitoredItems, listEntry, mon_tmp) {
26027  UA_NodeId_deleteMembers(&mon->monitoredNodeId);
26028  LIST_REMOVE(mon, listEntry);
26029  UA_free(mon);
26030  }
26031  LIST_REMOVE(sub, listEntry);
26032  UA_free(sub);
26033 }
26034 
26036 UA_Client_Subscriptions_addMonitoredItem(UA_Client *client, UA_UInt32 subscriptionId,
26037  UA_NodeId nodeId, UA_UInt32 attributeID,
26038  UA_MonitoredItemHandlingFunction hf,
26039  void *hfContext, UA_UInt32 *newMonitoredItemId) {
26040  UA_Client_Subscription *sub;
26041  LIST_FOREACH(sub, &client->subscriptions, listEntry) {
26042  if(sub->subscriptionID == subscriptionId)
26043  break;
26044  }
26045  if(!sub)
26047 
26048  /* Create the handler */
26049  UA_Client_MonitoredItem *newMon = UA_malloc(sizeof(UA_Client_MonitoredItem));
26050  if(!newMon)
26052 
26053  /* Send the request */
26055  UA_CreateMonitoredItemsRequest_init(&request);
26056  request.subscriptionId = subscriptionId;
26058  UA_MonitoredItemCreateRequest_init(&item);
26059  item.itemToMonitor.nodeId = nodeId;
26060  item.itemToMonitor.attributeId = attributeID;
26062  item.requestedParameters.clientHandle = ++(client->monitoredItemHandles);
26063  item.requestedParameters.samplingInterval = sub->publishingInterval;
26064  item.requestedParameters.discardOldest = true;
26065  item.requestedParameters.queueSize = 1;
26066  request.itemsToCreate = &item;
26067  request.itemsToCreateSize = 1;
26068  UA_CreateMonitoredItemsResponse response = UA_Client_Service_createMonitoredItems(client, request);
26069 
26070  // slight misuse of retval here to check if the addition was successfull.
26071  UA_StatusCode retval = response.responseHeader.serviceResult;
26072  if(retval == UA_STATUSCODE_GOOD) {
26073  if(response.resultsSize == 1)
26074  retval = response.results[0].statusCode;
26075  else
26077  }
26078  if(retval != UA_STATUSCODE_GOOD) {
26079  UA_free(newMon);
26080  UA_CreateMonitoredItemsResponse_deleteMembers(&response);
26081  return retval;
26082  }
26083 
26084  /* Set the handler */
26085  newMon->monitoringMode = UA_MONITORINGMODE_REPORTING;
26086  UA_NodeId_copy(&nodeId, &newMon->monitoredNodeId);
26087  newMon->attributeID = attributeID;
26088  newMon->clientHandle = client->monitoredItemHandles;
26089  newMon->samplingInterval = sub->publishingInterval;
26090  newMon->queueSize = 1;
26091  newMon->discardOldest = true;
26092  newMon->handler = hf;
26093  newMon->handlerContext = hfContext;
26094  newMon->monitoredItemId = response.results[0].monitoredItemId;
26095  LIST_INSERT_HEAD(&sub->monitoredItems, newMon, listEntry);
26096  *newMonitoredItemId = newMon->monitoredItemId;
26097 
26098  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT,
26099  "Created a monitored item with client handle %u",
26100  client->monitoredItemHandles);
26101 
26102  UA_CreateMonitoredItemsResponse_deleteMembers(&response);
26103  return UA_STATUSCODE_GOOD;
26104 }
26105 
26107 UA_Client_Subscriptions_removeMonitoredItem(UA_Client *client, UA_UInt32 subscriptionId,
26108  UA_UInt32 monitoredItemId) {
26109  UA_Client_Subscription *sub;
26110  LIST_FOREACH(sub, &client->subscriptions, listEntry) {
26111  if(sub->subscriptionID == subscriptionId)
26112  break;
26113  }
26114  if(!sub)
26116 
26117  UA_Client_MonitoredItem *mon;
26118  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
26119  if(mon->monitoredItemId == monitoredItemId)
26120  break;
26121  }
26122  if(!mon)
26124 
26125  /* remove the monitoreditem remotely */
26127  UA_DeleteMonitoredItemsRequest_init(&request);
26128  request.subscriptionId = sub->subscriptionID;
26129  request.monitoredItemIdsSize = 1;
26130  request.monitoredItemIds = &mon->monitoredItemId;
26131  UA_DeleteMonitoredItemsResponse response = UA_Client_Service_deleteMonitoredItems(client, request);
26132 
26133  UA_StatusCode retval = response.responseHeader.serviceResult;
26134  if(retval == UA_STATUSCODE_GOOD && response.resultsSize > 1)
26135  retval = response.results[0];
26136  UA_DeleteMonitoredItemsResponse_deleteMembers(&response);
26137  if(retval != UA_STATUSCODE_GOOD &&
26139  UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_CLIENT,
26140  "Could not remove monitoreditem %u with error code %s",
26141  monitoredItemId, UA_StatusCode_name(retval));
26142  return retval;
26143  }
26144 
26145  LIST_REMOVE(mon, listEntry);
26146  UA_NodeId_deleteMembers(&mon->monitoredNodeId);
26147  UA_free(mon);
26148  return UA_STATUSCODE_GOOD;
26149 }
26150 
26151 static void
26152 UA_Client_processPublishResponse(UA_Client *client, UA_PublishRequest *request,
26153  UA_PublishResponse *response) {
26155  return;
26156 
26157  /* Find the subscription */
26158  UA_Client_Subscription *sub;
26159  LIST_FOREACH(sub, &client->subscriptions, listEntry) {
26160  if(sub->subscriptionID == response->subscriptionId)
26161  break;
26162  }
26163  if(!sub)
26164  return;
26165 
26166  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT,
26167  "Processing a publish response on subscription %u with %u notifications",
26168  sub->subscriptionID, response->notificationMessage.notificationDataSize);
26169 
26170  /* Check if the server has acknowledged any of the sent ACKs */
26171  for(size_t i = 0; i < response->resultsSize && i < request->subscriptionAcknowledgementsSize; ++i) {
26172  /* remove also acks that are unknown to the server */
26173  if(response->results[i] != UA_STATUSCODE_GOOD &&
26175  continue;
26176 
26177  /* Remove the ack from the list */
26179  UA_Client_NotificationsAckNumber *ack;
26180  LIST_FOREACH(ack, &client->pendingNotificationsAcks, listEntry) {
26181  if(ack->subAck.subscriptionId == orig_ack->subscriptionId &&
26182  ack->subAck.sequenceNumber == orig_ack->sequenceNumber) {
26183  LIST_REMOVE(ack, listEntry);
26184  UA_free(ack);
26185  UA_assert(ack != LIST_FIRST(&client->pendingNotificationsAcks));
26186  break;
26187  }
26188  }
26189  }
26190 
26191  /* Process the notification messages */
26192  UA_NotificationMessage *msg = &response->notificationMessage;
26193  for(size_t k = 0; k < msg->notificationDataSize; ++k) {
26195  continue;
26196 
26197  /* Currently only dataChangeNotifications are supported */
26199  continue;
26200 
26201  UA_DataChangeNotification *dataChangeNotification = msg->notificationData[k].content.decoded.data;
26202  for(size_t j = 0; j < dataChangeNotification->monitoredItemsSize; ++j) {
26203  UA_MonitoredItemNotification *mitemNot = &dataChangeNotification->monitoredItems[j];
26204  UA_Client_MonitoredItem *mon;
26205  LIST_FOREACH(mon, &sub->monitoredItems, listEntry) {
26206  if(mon->clientHandle == mitemNot->clientHandle) {
26207  mon->handler(mon->monitoredItemId, &mitemNot->value, mon->handlerContext);
26208  break;
26209  }
26210  }
26211  if(!mon)
26212  UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT,
26213  "Could not process a notification with clienthandle %u on subscription %u",
26214  mitemNot->clientHandle, sub->subscriptionID);
26215  }
26216  }
26217 
26218  /* Add to the list of pending acks */
26219  UA_Client_NotificationsAckNumber *tmpAck = UA_malloc(sizeof(UA_Client_NotificationsAckNumber));
26220  if(!tmpAck) {
26221  UA_LOG_WARNING(client->config.logger, UA_LOGCATEGORY_CLIENT,
26222  "Not enough memory to store the acknowledgement for a "
26223  "publish message on subscription %u", sub->subscriptionID);
26224  return;
26225  }
26226  tmpAck->subAck.sequenceNumber = msg->sequenceNumber;
26227  tmpAck->subAck.subscriptionId = sub->subscriptionID;
26228  LIST_INSERT_HEAD(&client->pendingNotificationsAcks, tmpAck, listEntry);
26229 }
26230 
26232 UA_Client_Subscriptions_manuallySendPublishRequest(UA_Client *client) {
26233  if (client->state == UA_CLIENTSTATE_ERRORED)
26235 
26236  UA_Boolean moreNotifications = true;
26237  while(moreNotifications) {
26238  UA_PublishRequest request;
26239  UA_PublishRequest_init(&request);
26241 
26242  UA_Client_NotificationsAckNumber *ack;
26243  LIST_FOREACH(ack, &client->pendingNotificationsAcks, listEntry)
26245  if(request.subscriptionAcknowledgementsSize > 0) {
26248  if(!request.subscriptionAcknowledgements)
26249  return UA_STATUSCODE_GOOD;
26250  }
26251 
26252  int i = 0;
26253  LIST_FOREACH(ack, &client->pendingNotificationsAcks, listEntry) {
26254  request.subscriptionAcknowledgements[i].sequenceNumber = ack->subAck.sequenceNumber;
26255  request.subscriptionAcknowledgements[i].subscriptionId = ack->subAck.subscriptionId;
26256  ++i;
26257  }
26258 
26259  UA_PublishResponse response = UA_Client_Service_publish(client, request);
26260  UA_Client_processPublishResponse(client, &request, &response);
26261  moreNotifications = response.moreNotifications;
26262 
26263  UA_PublishResponse_deleteMembers(&response);
26264  UA_PublishRequest_deleteMembers(&request);
26265  }
26266  return UA_STATUSCODE_GOOD;
26267 }
26268 
26269 #endif /* UA_ENABLE_SUBSCRIPTIONS */
26270 
26271 /*********************************** amalgamated original file "/home/iosb/sw/open62541/deps/libc_time.c" ***********************************/
26272 
26273 /*
26274  * Originally released by the musl project (http://www.musl-libc.org/) under the
26275  * MIT license. Taken from the file /src/time/__secs_to_tm.c
26276  */
26277 
26278 
26279 /* 2000-03-01 (mod 400 year, immediately after feb29 */
26280 #define LEAPOCH (946684800LL + 86400*(31+29))
26281 
26282 #define DAYS_PER_400Y (365*400 + 97)
26283 #define DAYS_PER_100Y (365*100 + 24)
26284 #define DAYS_PER_4Y (365*4 + 1)
26285 
26286 int __secs_to_tm(long long t, struct tm *tm)
26287 {
26288  long long days, secs, years;
26289  int remdays, remsecs, remyears;
26290  int qc_cycles, c_cycles, q_cycles;
26291  int months;
26292  int wday, yday, leap;
26293  static const char days_in_month[] = {31,30,31,30,31,31,30,31,30,31,31,29};
26294 
26295  /* Reject time_t values whose year would overflow int */
26296  if (t < INT_MIN * 31622400LL || t > INT_MAX * 31622400LL)
26297  return -1;
26298 
26299  secs = t - LEAPOCH;
26300  days = secs / 86400LL;
26301  remsecs = (int)(secs % 86400);
26302  if (remsecs < 0) {
26303  remsecs += 86400;
26304  --days;
26305  }
26306 
26307  wday = (int)((3+days)%7);
26308  if (wday < 0) wday += 7;
26309 
26310  qc_cycles = (int)(days / DAYS_PER_400Y);
26311  remdays = (int)(days % DAYS_PER_400Y);
26312  if (remdays < 0) {
26313  remdays += DAYS_PER_400Y;
26314  --qc_cycles;
26315  }
26316 
26317  c_cycles = remdays / DAYS_PER_100Y;
26318  if (c_cycles == 4) --c_cycles;
26319  remdays -= c_cycles * DAYS_PER_100Y;
26320 
26321  q_cycles = remdays / DAYS_PER_4Y;
26322  if (q_cycles == 25) --q_cycles;
26323  remdays -= q_cycles * DAYS_PER_4Y;
26324 
26325  remyears = remdays / 365;
26326  if (remyears == 4) --remyears;
26327  remdays -= remyears * 365;
26328 
26329  leap = !remyears && (q_cycles || !c_cycles);
26330  yday = remdays + 31 + 28 + leap;
26331  if (yday >= 365+leap) yday -= 365+leap;
26332 
26333  years = remyears + 4*q_cycles + 100*c_cycles + 400LL*qc_cycles;
26334 
26335  for (months=0; days_in_month[months] <= remdays; ++months)
26336  remdays -= days_in_month[months];
26337 
26338  if (years+100 > INT_MAX || years+100 < INT_MIN)
26339  return -1;
26340 
26341  tm->tm_year = (int)(years + 100);
26342  tm->tm_mon = months + 2;
26343  if (tm->tm_mon >= 12) {
26344  tm->tm_mon -=12;
26345  ++tm->tm_year;
26346  }
26347  tm->tm_mday = remdays + 1;
26348  tm->tm_wday = wday;
26349  tm->tm_yday = yday;
26350 
26351  tm->tm_hour = remsecs / 3600;
26352  tm->tm_min = remsecs / 60 % 60;
26353  tm->tm_sec = remsecs % 60;
26354 
26355  return 0;
26356 }
26357 
26358 /*********************************** amalgamated original file "/home/iosb/sw/open62541/deps/pcg_basic.c" ***********************************/
26359 
26360 /*
26361  * PCG Random Number Generation for C.
26362  *
26363  * Copyright 2014 Melissa O'Neill <oneill@pcg-random.org>
26364  *
26365  * Licensed under the Apache License, Version 2.0 (the "License");
26366  * you may not use this file except in compliance with the License.
26367  * You may obtain a copy of the License at
26368  *
26369  * http://www.apache.org/licenses/LICENSE-2.0
26370  *
26371  * Unless required by applicable law or agreed to in writing, software
26372  * distributed under the License is distributed on an "AS IS" BASIS,
26373  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26374  * See the License for the specific language governing permissions and
26375  * limitations under the License.
26376  *
26377  * For additional information about the PCG random number generation scheme,
26378  * including its license and other licensing options, visit
26379  *
26380  * http://www.pcg-random.org
26381  */
26382 
26383 
26384 void pcg32_srandom_r(pcg32_random_t* rng, uint64_t initial_state, uint64_t initseq) {
26385  rng->state = 0U;
26386  rng->inc = (initseq << 1u) | 1u;
26387  pcg32_random_r(rng);
26388  rng->state += initial_state;
26389  pcg32_random_r(rng);
26390 }
26391 
26393  uint64_t oldstate = rng->state;
26394  rng->state = oldstate * 6364136223846793005ULL + rng->inc;
26395  uint32_t xorshifted = (uint32_t)(((oldstate >> 18u) ^ oldstate) >> 27u);
26396  uint32_t rot = (uint32_t)(oldstate >> 59u);
26397  return (xorshifted >> rot) | (xorshifted << ((~rot + 1u) & 31)); /* was (xorshifted >> rot) | (xorshifted << ((-rot) & 31)) */
26398 }
26399 
26400 /*********************************** amalgamated original file "/home/iosb/sw/open62541/build/src_generated/ua_statuscode_descriptions.c" ***********************************/
26401 
26402 /**********************************************************
26403  * Autogenerated -- do not modify
26404  * Generated from /home/iosb/sw/open62541/tools/schema/Opc.Ua.StatusCodes.csv with script /home/iosb/sw/open62541/tools/generate_statuscode_descriptions.py
26405  *********************************************************/
26406 
26407 
26408 #ifndef UA_ENABLE_STATUSCODE_DESCRIPTIONS
26409 static const size_t statusCodeDescriptionsSize = 1;
26410 static const UA_StatusCodeDescription statusCodeDescriptions[1] = {
26411  {0xffffffff, "StatusCode descriptions not available", "open62541 was compiled without support for statuscode descriptions"}
26412 };
26413 #else
26414 static const size_t statusCodeDescriptionsSize = 229;
26415 static const UA_StatusCodeDescription statusCodeDescriptions[229] =
26416 {
26417  {UA_STATUSCODE_GOOD, "Good", "Success / No error"},
26418  {UA_STATUSCODE_BADUNEXPECTEDERROR, "BadUnexpectedError", "An unexpected error occurred."},
26419  {UA_STATUSCODE_BADINTERNALERROR, "BadInternalError", "An internal error occurred as a result of a programming or configuration error."},
26420  {UA_STATUSCODE_BADOUTOFMEMORY, "BadOutOfMemory", "Not enough memory to complete the operation."},
26421  {UA_STATUSCODE_BADRESOURCEUNAVAILABLE, "BadResourceUnavailable", "An operating system resource is not available."},
26422  {UA_STATUSCODE_BADCOMMUNICATIONERROR, "BadCommunicationError", "A low level communication error occurred."},
26423  {UA_STATUSCODE_BADENCODINGERROR, "BadEncodingError", "Encoding halted because of invalid data in the objects being serialized."},
26424  {UA_STATUSCODE_BADDECODINGERROR, "BadDecodingError", "Decoding halted because of invalid data in the stream."},
26425  {UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED, "BadEncodingLimitsExceeded", "The message encoding/decoding limits imposed by the stack have been exceeded."},
26426  {UA_STATUSCODE_BADREQUESTTOOLARGE, "BadRequestTooLarge", "The request message size exceeds limits set by the server."},
26427  {UA_STATUSCODE_BADRESPONSETOOLARGE, "BadResponseTooLarge", "The response message size exceeds limits set by the client."},
26428  {UA_STATUSCODE_BADUNKNOWNRESPONSE, "BadUnknownResponse", "An unrecognized response was received from the server."},
26429  {UA_STATUSCODE_BADTIMEOUT, "BadTimeout", "The operation timed out."},
26430  {UA_STATUSCODE_BADSERVICEUNSUPPORTED, "BadServiceUnsupported", "The server does not support the requested service."},
26431  {UA_STATUSCODE_BADSHUTDOWN, "BadShutdown", "The operation was cancelled because the application is shutting down."},
26432  {UA_STATUSCODE_BADSERVERNOTCONNECTED, "BadServerNotConnected", "The operation could not complete because the client is not connected to the server."},
26433  {UA_STATUSCODE_BADSERVERHALTED, "BadServerHalted", "The server has stopped and cannot process any requests."},
26434  {UA_STATUSCODE_BADNOTHINGTODO, "BadNothingToDo", "There was nothing to do because the client passed a list of operations with no elements."},
26435  {UA_STATUSCODE_BADTOOMANYOPERATIONS, "BadTooManyOperations", "The request could not be processed because it specified too many operations."},
26436  {UA_STATUSCODE_BADTOOMANYMONITOREDITEMS, "BadTooManyMonitoredItems", "The request could not be processed because there are too many monitored items in the subscription."},
26437  {UA_STATUSCODE_BADDATATYPEIDUNKNOWN, "BadDataTypeIdUnknown", "The extension object cannot be (de)serialized because the data type id is not recognized."},
26438  {UA_STATUSCODE_BADCERTIFICATEINVALID, "BadCertificateInvalid", "The certificate provided as a parameter is not valid."},
26439  {UA_STATUSCODE_BADSECURITYCHECKSFAILED, "BadSecurityChecksFailed", "An error occurred verifying security."},
26440  {UA_STATUSCODE_BADCERTIFICATETIMEINVALID, "BadCertificateTimeInvalid", "The Certificate has expired or is not yet valid."},
26441  {UA_STATUSCODE_BADCERTIFICATEISSUERTIMEINVALID, "BadCertificateIssuerTimeInvalid", "An Issuer Certificate has expired or is not yet valid."},
26442  {UA_STATUSCODE_BADCERTIFICATEHOSTNAMEINVALID, "BadCertificateHostNameInvalid", "The HostName used to connect to a Server does not match a HostName in the Certificate."},
26443  {UA_STATUSCODE_BADCERTIFICATEURIINVALID, "BadCertificateUriInvalid", "The URI specified in the ApplicationDescription does not match the URI in the Certificate."},
26444  {UA_STATUSCODE_BADCERTIFICATEUSENOTALLOWED, "BadCertificateUseNotAllowed", "The Certificate may not be used for the requested operation."},
26445  {UA_STATUSCODE_BADCERTIFICATEISSUERUSENOTALLOWED, "BadCertificateIssuerUseNotAllowed", "The Issuer Certificate may not be used for the requested operation."},
26446  {UA_STATUSCODE_BADCERTIFICATEUNTRUSTED, "BadCertificateUntrusted", "The Certificate is not trusted."},
26447  {UA_STATUSCODE_BADCERTIFICATEREVOCATIONUNKNOWN, "BadCertificateRevocationUnknown", "It was not possible to determine if the Certificate has been revoked."},
26448  {UA_STATUSCODE_BADCERTIFICATEISSUERREVOCATIONUNKNOWN, "BadCertificateIssuerRevocationUnknown", "It was not possible to determine if the Issuer Certificate has been revoked."},
26449  {UA_STATUSCODE_BADCERTIFICATEREVOKED, "BadCertificateRevoked", "The certificate has been revoked."},
26450  {UA_STATUSCODE_BADCERTIFICATEISSUERREVOKED, "BadCertificateIssuerRevoked", "The issuer certificate has been revoked."},
26451  {UA_STATUSCODE_BADCERTIFICATECHAININCOMPLETE, "BadCertificateChainIncomplete", "The certificate chain is incomplete."},
26452  {UA_STATUSCODE_BADUSERACCESSDENIED, "BadUserAccessDenied", "User does not have permission to perform the requested operation."},
26453  {UA_STATUSCODE_BADIDENTITYTOKENINVALID, "BadIdentityTokenInvalid", "The user identity token is not valid."},
26454  {UA_STATUSCODE_BADIDENTITYTOKENREJECTED, "BadIdentityTokenRejected", "The user identity token is valid but the server has rejected it."},
26455  {UA_STATUSCODE_BADSECURECHANNELIDINVALID, "BadSecureChannelIdInvalid", "The specified secure channel is no longer valid."},
26456  {UA_STATUSCODE_BADINVALIDTIMESTAMP, "BadInvalidTimestamp", "The timestamp is outside the range allowed by the server."},
26457  {UA_STATUSCODE_BADNONCEINVALID, "BadNonceInvalid", "The nonce does appear to be not a random value or it is not the correct length."},
26458  {UA_STATUSCODE_BADSESSIONIDINVALID, "BadSessionIdInvalid", "The session id is not valid."},
26459  {UA_STATUSCODE_BADSESSIONCLOSED, "BadSessionClosed", "The session was closed by the client."},
26460  {UA_STATUSCODE_BADSESSIONNOTACTIVATED, "BadSessionNotActivated", "The session cannot be used because ActivateSession has not been called."},
26461  {UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID, "BadSubscriptionIdInvalid", "The subscription id is not valid."},
26462  {UA_STATUSCODE_BADREQUESTHEADERINVALID, "BadRequestHeaderInvalid", "The header for the request is missing or invalid."},
26463  {UA_STATUSCODE_BADTIMESTAMPSTORETURNINVALID, "BadTimestampsToReturnInvalid", "The timestamps to return parameter is invalid."},
26464  {UA_STATUSCODE_BADREQUESTCANCELLEDBYCLIENT, "BadRequestCancelledByClient", "The request was cancelled by the client."},
26465  {UA_STATUSCODE_BADTOOMANYARGUMENTS, "BadTooManyArguments", "Too many arguments were provided."},
26466  {UA_STATUSCODE_GOODSUBSCRIPTIONTRANSFERRED, "GoodSubscriptionTransferred", "The subscription was transferred to another session."},
26467  {UA_STATUSCODE_GOODCOMPLETESASYNCHRONOUSLY, "GoodCompletesAsynchronously", "The processing will complete asynchronously."},
26468  {UA_STATUSCODE_GOODOVERLOAD, "GoodOverload", "Sampling has slowed down due to resource limitations."},
26469  {UA_STATUSCODE_GOODCLAMPED, "GoodClamped", "The value written was accepted but was clamped."},
26470  {UA_STATUSCODE_BADNOCOMMUNICATION, "BadNoCommunication", "Communication with the data source is defined"},
26471  {UA_STATUSCODE_BADWAITINGFORINITIALDATA, "BadWaitingForInitialData", "Waiting for the server to obtain values from the underlying data source."},
26472  {UA_STATUSCODE_BADNODEIDINVALID, "BadNodeIdInvalid", "The syntax of the node id is not valid."},
26473  {UA_STATUSCODE_BADNODEIDUNKNOWN, "BadNodeIdUnknown", "The node id refers to a node that does not exist in the server address space."},
26474  {UA_STATUSCODE_BADATTRIBUTEIDINVALID, "BadAttributeIdInvalid", "The attribute is not supported for the specified Node."},
26475  {UA_STATUSCODE_BADINDEXRANGEINVALID, "BadIndexRangeInvalid", "The syntax of the index range parameter is invalid."},
26476  {UA_STATUSCODE_BADINDEXRANGENODATA, "BadIndexRangeNoData", "No data exists within the range of indexes specified."},
26477  {UA_STATUSCODE_BADDATAENCODINGINVALID, "BadDataEncodingInvalid", "The data encoding is invalid."},
26478  {UA_STATUSCODE_BADDATAENCODINGUNSUPPORTED, "BadDataEncodingUnsupported", "The server does not support the requested data encoding for the node."},
26479  {UA_STATUSCODE_BADNOTREADABLE, "BadNotReadable", "The access level does not allow reading or subscribing to the Node."},
26480  {UA_STATUSCODE_BADNOTWRITABLE, "BadNotWritable", "The access level does not allow writing to the Node."},
26481  {UA_STATUSCODE_BADOUTOFRANGE, "BadOutOfRange", "The value was out of range."},
26482  {UA_STATUSCODE_BADNOTSUPPORTED, "BadNotSupported", "The requested operation is not supported."},
26483  {UA_STATUSCODE_BADNOTFOUND, "BadNotFound", "A requested item was not found or a search operation ended without success."},
26484  {UA_STATUSCODE_BADOBJECTDELETED, "BadObjectDeleted", "The object cannot be used because it has been deleted."},
26485  {UA_STATUSCODE_BADNOTIMPLEMENTED, "BadNotImplemented", "Requested operation is not implemented."},
26486  {UA_STATUSCODE_BADMONITORINGMODEINVALID, "BadMonitoringModeInvalid", "The monitoring mode is invalid."},
26487  {UA_STATUSCODE_BADMONITOREDITEMIDINVALID, "BadMonitoredItemIdInvalid", "The monitoring item id does not refer to a valid monitored item."},
26488  {UA_STATUSCODE_BADMONITOREDITEMFILTERINVALID, "BadMonitoredItemFilterInvalid", "The monitored item filter parameter is not valid."},
26489  {UA_STATUSCODE_BADMONITOREDITEMFILTERUNSUPPORTED, "BadMonitoredItemFilterUnsupported", "The server does not support the requested monitored item filter."},
26490  {UA_STATUSCODE_BADFILTERNOTALLOWED, "BadFilterNotAllowed", "A monitoring filter cannot be used in combination with the attribute specified."},
26491  {UA_STATUSCODE_BADSTRUCTUREMISSING, "BadStructureMissing", "A mandatory structured parameter was missing or null."},
26492  {UA_STATUSCODE_BADEVENTFILTERINVALID, "BadEventFilterInvalid", "The event filter is not valid."},
26493  {UA_STATUSCODE_BADCONTENTFILTERINVALID, "BadContentFilterInvalid", "The content filter is not valid."},
26494  {UA_STATUSCODE_BADFILTEROPERATORINVALID, "BadFilterOperatorInvalid", "An unregognized operator was provided in a filter."},
26495  {UA_STATUSCODE_BADFILTEROPERATORUNSUPPORTED, "BadFilterOperatorUnsupported", "A valid operator was provided"},
26496  {UA_STATUSCODE_BADFILTEROPERANDCOUNTMISMATCH, "BadFilterOperandCountMismatch", "The number of operands provided for the filter operator was less then expected for the operand provided."},
26497  {UA_STATUSCODE_BADFILTEROPERANDINVALID, "BadFilterOperandInvalid", "The operand used in a content filter is not valid."},
26498  {UA_STATUSCODE_BADFILTERELEMENTINVALID, "BadFilterElementInvalid", "The referenced element is not a valid element in the content filter."},
26499  {UA_STATUSCODE_BADFILTERLITERALINVALID, "BadFilterLiteralInvalid", "The referenced literal is not a valid value."},
26500  {UA_STATUSCODE_BADCONTINUATIONPOINTINVALID, "BadContinuationPointInvalid", "The continuation point provide is longer valid."},
26501  {UA_STATUSCODE_BADNOCONTINUATIONPOINTS, "BadNoContinuationPoints", "The operation could not be processed because all continuation points have been allocated."},
26502  {UA_STATUSCODE_BADREFERENCETYPEIDINVALID, "BadReferenceTypeIdInvalid", "The operation could not be processed because all continuation points have been allocated."},
26503  {UA_STATUSCODE_BADBROWSEDIRECTIONINVALID, "BadBrowseDirectionInvalid", "The browse direction is not valid."},
26504  {UA_STATUSCODE_BADNODENOTINVIEW, "BadNodeNotInView", "The node is not part of the view."},
26505  {UA_STATUSCODE_BADSERVERURIINVALID, "BadServerUriInvalid", "The ServerUri is not a valid URI."},
26506  {UA_STATUSCODE_BADSERVERNAMEMISSING, "BadServerNameMissing", "No ServerName was specified."},
26507  {UA_STATUSCODE_BADDISCOVERYURLMISSING, "BadDiscoveryUrlMissing", "No DiscoveryUrl was specified."},
26508  {UA_STATUSCODE_BADSEMPAHOREFILEMISSING, "BadSempahoreFileMissing", "The semaphore file specified by the client is not valid."},
26509  {UA_STATUSCODE_BADREQUESTTYPEINVALID, "BadRequestTypeInvalid", "The security token request type is not valid."},
26510  {UA_STATUSCODE_BADSECURITYMODEREJECTED, "BadSecurityModeRejected", "The security mode does not meet the requirements set by the Server."},
26511  {UA_STATUSCODE_BADSECURITYPOLICYREJECTED, "BadSecurityPolicyRejected", "The security policy does not meet the requirements set by the Server."},
26512  {UA_STATUSCODE_BADTOOMANYSESSIONS, "BadTooManySessions", "The server has reached its maximum number of sessions."},
26513  {UA_STATUSCODE_BADUSERSIGNATUREINVALID, "BadUserSignatureInvalid", "The user token signature is missing or invalid."},
26514  {UA_STATUSCODE_BADAPPLICATIONSIGNATUREINVALID, "BadApplicationSignatureInvalid", "The signature generated with the client certificate is missing or invalid."},
26515  {UA_STATUSCODE_BADNOVALIDCERTIFICATES, "BadNoValidCertificates", "The client did not provide at least one software certificate that is valid and meets the profile requirements for the server."},
26516  {UA_STATUSCODE_BADIDENTITYCHANGENOTSUPPORTED, "BadIdentityChangeNotSupported", "The Server does not support changing the user identity assigned to the session."},
26517  {UA_STATUSCODE_BADREQUESTCANCELLEDBYREQUEST, "BadRequestCancelledByRequest", "The request was cancelled by the client with the Cancel service."},
26518  {UA_STATUSCODE_BADPARENTNODEIDINVALID, "BadParentNodeIdInvalid", "The parent node id does not to refer to a valid node."},
26519  {UA_STATUSCODE_BADREFERENCENOTALLOWED, "BadReferenceNotAllowed", "The reference could not be created because it violates constraints imposed by the data model."},
26520  {UA_STATUSCODE_BADNODEIDREJECTED, "BadNodeIdRejected", "The requested node id was reject because it was either invalid or server does not allow node ids to be specified by the client."},
26521  {UA_STATUSCODE_BADNODEIDEXISTS, "BadNodeIdExists", "The requested node id is already used by another node."},
26522  {UA_STATUSCODE_BADNODECLASSINVALID, "BadNodeClassInvalid", "The node class is not valid."},
26523  {UA_STATUSCODE_BADBROWSENAMEINVALID, "BadBrowseNameInvalid", "The browse name is invalid."},
26524  {UA_STATUSCODE_BADBROWSENAMEDUPLICATED, "BadBrowseNameDuplicated", "The browse name is not unique among nodes that share the same relationship with the parent."},
26525  {UA_STATUSCODE_BADNODEATTRIBUTESINVALID, "BadNodeAttributesInvalid", "The node attributes are not valid for the node class."},
26526  {UA_STATUSCODE_BADTYPEDEFINITIONINVALID, "BadTypeDefinitionInvalid", "The type definition node id does not reference an appropriate type node."},
26527  {UA_STATUSCODE_BADSOURCENODEIDINVALID, "BadSourceNodeIdInvalid", "The source node id does not reference a valid node."},
26528  {UA_STATUSCODE_BADTARGETNODEIDINVALID, "BadTargetNodeIdInvalid", "The target node id does not reference a valid node."},
26529  {UA_STATUSCODE_BADDUPLICATEREFERENCENOTALLOWED, "BadDuplicateReferenceNotAllowed", "The reference type between the nodes is already defined."},
26530  {UA_STATUSCODE_BADINVALIDSELFREFERENCE, "BadInvalidSelfReference", "The server does not allow this type of self reference on this node."},
26531  {UA_STATUSCODE_BADREFERENCELOCALONLY, "BadReferenceLocalOnly", "The reference type is not valid for a reference to a remote server."},
26532  {UA_STATUSCODE_BADNODELETERIGHTS, "BadNoDeleteRights", "The server will not allow the node to be deleted."},
26533  {UA_STATUSCODE_UNCERTAINREFERENCENOTDELETED, "UncertainReferenceNotDeleted", "The server was not able to delete all target references."},
26534  {UA_STATUSCODE_BADSERVERINDEXINVALID, "BadServerIndexInvalid", "The server index is not valid."},
26535  {UA_STATUSCODE_BADVIEWIDUNKNOWN, "BadViewIdUnknown", "The view id does not refer to a valid view node."},
26536  {UA_STATUSCODE_BADVIEWTIMESTAMPINVALID, "BadViewTimestampInvalid", "The view timestamp is not available or not supported."},
26537  {UA_STATUSCODE_BADVIEWPARAMETERMISMATCH, "BadViewParameterMismatch", "The view parameters are not consistent with each other."},
26538  {UA_STATUSCODE_BADVIEWVERSIONINVALID, "BadViewVersionInvalid", "The view version is not available or not supported."},
26539  {UA_STATUSCODE_UNCERTAINNOTALLNODESAVAILABLE, "UncertainNotAllNodesAvailable", "The list of references may not be complete because the underlying system is not available."},
26540  {UA_STATUSCODE_GOODRESULTSMAYBEINCOMPLETE, "GoodResultsMayBeIncomplete", "The server should have followed a reference to a node in a remote server but did not. The result set may be incomplete."},
26541  {UA_STATUSCODE_BADNOTTYPEDEFINITION, "BadNotTypeDefinition", "The provided Nodeid was not a type definition nodeid."},
26542  {UA_STATUSCODE_UNCERTAINREFERENCEOUTOFSERVER, "UncertainReferenceOutOfServer", "One of the references to follow in the relative path references to a node in the address space in another server."},
26543  {UA_STATUSCODE_BADTOOMANYMATCHES, "BadTooManyMatches", "The requested operation has too many matches to return."},
26544  {UA_STATUSCODE_BADQUERYTOOCOMPLEX, "BadQueryTooComplex", "The requested operation requires too many resources in the server."},
26545  {UA_STATUSCODE_BADNOMATCH, "BadNoMatch", "The requested operation has no match to return."},
26546  {UA_STATUSCODE_BADMAXAGEINVALID, "BadMaxAgeInvalid", "The max age parameter is invalid."},
26547  {UA_STATUSCODE_BADSECURITYMODEINSUFFICIENT, "BadSecurityModeInsufficient", "The operation is not permitted over the current secure channel."},
26548  {UA_STATUSCODE_BADHISTORYOPERATIONINVALID, "BadHistoryOperationInvalid", "The history details parameter is not valid."},
26549  {UA_STATUSCODE_BADHISTORYOPERATIONUNSUPPORTED, "BadHistoryOperationUnsupported", "The server does not support the requested operation."},
26550  {UA_STATUSCODE_BADINVALIDTIMESTAMPARGUMENT, "BadInvalidTimestampArgument", "The defined timestamp to return was invalid."},
26551  {UA_STATUSCODE_BADWRITENOTSUPPORTED, "BadWriteNotSupported", "The server not does support writing the combination of value"},
26552  {UA_STATUSCODE_BADTYPEMISMATCH, "BadTypeMismatch", "The value supplied for the attribute is not of the same type as the attribute's value."},
26553  {UA_STATUSCODE_BADMETHODINVALID, "BadMethodInvalid", "The method id does not refer to a method for the specified object."},
26554  {UA_STATUSCODE_BADARGUMENTSMISSING, "BadArgumentsMissing", "The client did not specify all of the input arguments for the method."},
26555  {UA_STATUSCODE_BADTOOMANYSUBSCRIPTIONS, "BadTooManySubscriptions", "The server has reached its maximum number of subscriptions."},
26556  {UA_STATUSCODE_BADTOOMANYPUBLISHREQUESTS, "BadTooManyPublishRequests", "The server has reached the maximum number of queued publish requests."},
26557  {UA_STATUSCODE_BADNOSUBSCRIPTION, "BadNoSubscription", "There is no subscription available for this session."},
26558  {UA_STATUSCODE_BADSEQUENCENUMBERUNKNOWN, "BadSequenceNumberUnknown", "The sequence number is unknown to the server."},
26559  {UA_STATUSCODE_BADMESSAGENOTAVAILABLE, "BadMessageNotAvailable", "The requested notification message is no longer available."},
26560  {UA_STATUSCODE_BADINSUFFICIENTCLIENTPROFILE, "BadInsufficientClientProfile", "The Client of the current Session does not support one or more Profiles that are necessary for the Subscription."},
26561  {UA_STATUSCODE_BADSTATENOTACTIVE, "BadStateNotActive", "The sub-state machine is not currently active."},
26562  {UA_STATUSCODE_BADTCPSERVERTOOBUSY, "BadTcpServerTooBusy", "The server cannot process the request because it is too busy."},
26563  {UA_STATUSCODE_BADTCPMESSAGETYPEINVALID, "BadTcpMessageTypeInvalid", "The type of the message specified in the header invalid."},
26564  {UA_STATUSCODE_BADTCPSECURECHANNELUNKNOWN, "BadTcpSecureChannelUnknown", "The SecureChannelId and/or TokenId are not currently in use."},
26565  {UA_STATUSCODE_BADTCPMESSAGETOOLARGE, "BadTcpMessageTooLarge", "The size of the message specified in the header is too large."},
26566  {UA_STATUSCODE_BADTCPNOTENOUGHRESOURCES, "BadTcpNotEnoughResources", "There are not enough resources to process the request."},
26567  {UA_STATUSCODE_BADTCPINTERNALERROR, "BadTcpInternalError", "An internal error occurred."},
26568  {UA_STATUSCODE_BADTCPENDPOINTURLINVALID, "BadTcpEndpointUrlInvalid", "The Server does not recognize the QueryString specified."},
26569  {UA_STATUSCODE_BADREQUESTINTERRUPTED, "BadRequestInterrupted", "The request could not be sent because of a network interruption."},
26570  {UA_STATUSCODE_BADREQUESTTIMEOUT, "BadRequestTimeout", "Timeout occurred while processing the request."},
26571  {UA_STATUSCODE_BADSECURECHANNELCLOSED, "BadSecureChannelClosed", "The secure channel has been closed."},
26572  {UA_STATUSCODE_BADSECURECHANNELTOKENUNKNOWN, "BadSecureChannelTokenUnknown", "The token has expired or is not recognized."},
26573  {UA_STATUSCODE_BADSEQUENCENUMBERINVALID, "BadSequenceNumberInvalid", "The sequence number is not valid."},
26574  {UA_STATUSCODE_BADPROTOCOLVERSIONUNSUPPORTED, "BadProtocolVersionUnsupported", "The applications do not have compatible protocol versions."},
26575  {UA_STATUSCODE_BADCONFIGURATIONERROR, "BadConfigurationError", "There is a problem with the configuration that affects the usefulness of the value."},
26576  {UA_STATUSCODE_BADNOTCONNECTED, "BadNotConnected", "The variable should receive its value from another variable"},
26577  {UA_STATUSCODE_BADDEVICEFAILURE, "BadDeviceFailure", "There has been a failure in the device/data source that generates the value that has affected the value."},
26578  {UA_STATUSCODE_BADSENSORFAILURE, "BadSensorFailure", "There has been a failure in the sensor from which the value is derived by the device/data source."},
26579  {UA_STATUSCODE_BADOUTOFSERVICE, "BadOutOfService", "The source of the data is not operational."},
26580  {UA_STATUSCODE_BADDEADBANDFILTERINVALID, "BadDeadbandFilterInvalid", "The deadband filter is not valid."},
26581  {UA_STATUSCODE_UNCERTAINNOCOMMUNICATIONLASTUSABLEVALUE, "UncertainNoCommunicationLastUsableValue", "Communication to the data source has failed. The variable value is the last value that had a good quality."},
26582  {UA_STATUSCODE_UNCERTAINLASTUSABLEVALUE, "UncertainLastUsableValue", "Whatever was updating this value has stopped doing so."},
26583  {UA_STATUSCODE_UNCERTAINSUBSTITUTEVALUE, "UncertainSubstituteValue", "The value is an operational value that was manually overwritten."},
26584  {UA_STATUSCODE_UNCERTAININITIALVALUE, "UncertainInitialValue", "The value is an initial value for a variable that normally receives its value from another variable."},
26585  {UA_STATUSCODE_UNCERTAINSENSORNOTACCURATE, "UncertainSensorNotAccurate", "The value is at one of the sensor limits."},
26586  {UA_STATUSCODE_UNCERTAINENGINEERINGUNITSEXCEEDED, "UncertainEngineeringUnitsExceeded", "The value is outside of the range of values defined for this parameter."},
26587  {UA_STATUSCODE_UNCERTAINSUBNORMAL, "UncertainSubNormal", "The value is derived from multiple sources and has less than the required number of Good sources."},
26588  {UA_STATUSCODE_GOODLOCALOVERRIDE, "GoodLocalOverride", "The value has been overridden."},
26589  {UA_STATUSCODE_BADREFRESHINPROGRESS, "BadRefreshInProgress", "This Condition refresh failed"},
26590  {UA_STATUSCODE_BADCONDITIONALREADYDISABLED, "BadConditionAlreadyDisabled", "This condition has already been disabled."},
26591  {UA_STATUSCODE_BADCONDITIONALREADYENABLED, "BadConditionAlreadyEnabled", "This condition has already been enabled."},
26592  {UA_STATUSCODE_BADCONDITIONDISABLED, "BadConditionDisabled", "Property not available"},
26593  {UA_STATUSCODE_BADEVENTIDUNKNOWN, "BadEventIdUnknown", "The specified event id is not recognized."},
26594  {UA_STATUSCODE_BADEVENTNOTACKNOWLEDGEABLE, "BadEventNotAcknowledgeable", "The event cannot be acknowledged."},
26595  {UA_STATUSCODE_BADDIALOGNOTACTIVE, "BadDialogNotActive", "The dialog condition is not active."},
26596  {UA_STATUSCODE_BADDIALOGRESPONSEINVALID, "BadDialogResponseInvalid", "The response is not valid for the dialog."},
26597  {UA_STATUSCODE_BADCONDITIONBRANCHALREADYACKED, "BadConditionBranchAlreadyAcked", "The condition branch has already been acknowledged."},
26598  {UA_STATUSCODE_BADCONDITIONBRANCHALREADYCONFIRMED, "BadConditionBranchAlreadyConfirmed", "The condition branch has already been confirmed."},
26599  {UA_STATUSCODE_BADCONDITIONALREADYSHELVED, "BadConditionAlreadyShelved", "The condition has already been shelved."},
26600  {UA_STATUSCODE_BADCONDITIONNOTSHELVED, "BadConditionNotShelved", "The condition is not currently shelved."},
26601  {UA_STATUSCODE_BADSHELVINGTIMEOUTOFRANGE, "BadShelvingTimeOutOfRange", "The shelving time not within an acceptable range."},
26602  {UA_STATUSCODE_BADNODATA, "BadNoData", "No data exists for the requested time range or event filter."},
26603  {UA_STATUSCODE_BADBOUNDNOTFOUND, "BadBoundNotFound", "No data found to provide upper or lower bound value."},
26604  {UA_STATUSCODE_BADBOUNDNOTSUPPORTED, "BadBoundNotSupported", "The server cannot retrieve a bound for the variable."},
26605  {UA_STATUSCODE_BADDATALOST, "BadDataLost", "Data is missing due to collection started/stopped/lost."},
26606  {UA_STATUSCODE_BADDATAUNAVAILABLE, "BadDataUnavailable", "Expected data is unavailable for the requested time range due to an un-mounted volume"},
26607  {UA_STATUSCODE_BADENTRYEXISTS, "BadEntryExists", "The data or event was not successfully inserted because a matching entry exists."},
26608  {UA_STATUSCODE_BADNOENTRYEXISTS, "BadNoEntryExists", "The data or event was not successfully updated because no matching entry exists."},
26609  {UA_STATUSCODE_BADTIMESTAMPNOTSUPPORTED, "BadTimestampNotSupported", "The client requested history using a timestamp format the server does not support (i.e requested ServerTimestamp when server only supports SourceTimestamp)."},
26610  {UA_STATUSCODE_GOODENTRYINSERTED, "GoodEntryInserted", "The data or event was successfully inserted into the historical database."},
26611  {UA_STATUSCODE_GOODENTRYREPLACED, "GoodEntryReplaced", "The data or event field was successfully replaced in the historical database."},
26612  {UA_STATUSCODE_UNCERTAINDATASUBNORMAL, "UncertainDataSubNormal", "The value is derived from multiple values and has less than the required number of Good values."},
26613  {UA_STATUSCODE_GOODNODATA, "GoodNoData", "No data exists for the requested time range or event filter."},
26614  {UA_STATUSCODE_GOODMOREDATA, "GoodMoreData", "The data or event field was successfully replaced in the historical database."},
26615  {UA_STATUSCODE_BADAGGREGATELISTMISMATCH, "BadAggregateListMismatch", "The requested number of Aggregates does not match the requested number of NodeIds."},
26616  {UA_STATUSCODE_BADAGGREGATENOTSUPPORTED, "BadAggregateNotSupported", "The requested Aggregate is not support by the server."},
26617  {UA_STATUSCODE_BADAGGREGATEINVALIDINPUTS, "BadAggregateInvalidInputs", "The aggregate value could not be derived due to invalid data inputs."},
26618  {UA_STATUSCODE_BADAGGREGATECONFIGURATIONREJECTED, "BadAggregateConfigurationRejected", "The aggregate configuration is not valid for specified node."},
26619  {UA_STATUSCODE_GOODDATAIGNORED, "GoodDataIgnored", "The request pecifies fields which are not valid for the EventType or cannot be saved by the historian."},
26620  {UA_STATUSCODE_BADREQUESTNOTALLOWED, "BadRequestNotAllowed", "The request was rejected by the server because it did not meet the criteria set by the server."},
26621  {UA_STATUSCODE_GOODEDITED, "GoodEdited", "The value does not come from the real source and has been edited by the server."},
26622  {UA_STATUSCODE_GOODPOSTACTIONFAILED, "GoodPostActionFailed", "There was an error in execution of these post-actions."},
26623  {UA_STATUSCODE_UNCERTAINDOMINANTVALUECHANGED, "UncertainDominantValueChanged", "The related EngineeringUnit has been changed but the Variable Value is still provided based on the previous unit."},
26624  {UA_STATUSCODE_GOODDEPENDENTVALUECHANGED, "GoodDependentValueChanged", "A dependent value has been changed but the change has not been applied to the device."},
26625  {UA_STATUSCODE_BADDOMINANTVALUECHANGED, "BadDominantValueChanged", "The related EngineeringUnit has been changed but this change has not been applied to the device. The Variable Value is still dependent on the previous unit but its status is currently Bad."},
26626  {UA_STATUSCODE_UNCERTAINDEPENDENTVALUECHANGED, "UncertainDependentValueChanged", "A dependent value has been changed but the change has not been applied to the device. The quality of the dominant variable is uncertain."},
26627  {UA_STATUSCODE_BADDEPENDENTVALUECHANGED, "BadDependentValueChanged", "A dependent value has been changed but the change has not been applied to the device. The quality of the dominant variable is Bad."},
26628  {UA_STATUSCODE_GOODCOMMUNICATIONEVENT, "GoodCommunicationEvent", "The communication layer has raised an event."},
26629  {UA_STATUSCODE_GOODSHUTDOWNEVENT, "GoodShutdownEvent", "The system is shutting down."},
26630  {UA_STATUSCODE_GOODCALLAGAIN, "GoodCallAgain", "The operation is not finished and needs to be called again."},
26631  {UA_STATUSCODE_GOODNONCRITICALTIMEOUT, "GoodNonCriticalTimeout", "A non-critical timeout occurred."},
26632  {UA_STATUSCODE_BADINVALIDARGUMENT, "BadInvalidArgument", "One or more arguments are invalid."},
26633  {UA_STATUSCODE_BADCONNECTIONREJECTED, "BadConnectionRejected", "Could not establish a network connection to remote server."},
26634  {UA_STATUSCODE_BADDISCONNECT, "BadDisconnect", "The server has disconnected from the client."},
26635  {UA_STATUSCODE_BADCONNECTIONCLOSED, "BadConnectionClosed", "The network connection has been closed."},
26636  {UA_STATUSCODE_BADINVALIDSTATE, "BadInvalidState", "The operation cannot be completed because the object is closed"},
26637  {UA_STATUSCODE_BADENDOFSTREAM, "BadEndOfStream", "Cannot move beyond end of the stream."},
26638  {UA_STATUSCODE_BADNODATAAVAILABLE, "BadNoDataAvailable", "No data is currently available for reading from a non-blocking stream."},
26639  {UA_STATUSCODE_BADWAITINGFORRESPONSE, "BadWaitingForResponse", "The asynchronous operation is waiting for a response."},
26640  {UA_STATUSCODE_BADOPERATIONABANDONED, "BadOperationAbandoned", "The asynchronous operation was abandoned by the caller."},
26641  {UA_STATUSCODE_BADEXPECTEDSTREAMTOBLOCK, "BadExpectedStreamToBlock", "The stream did not return all data requested (possibly because it is a non-blocking stream)."},
26642  {UA_STATUSCODE_BADWOULDBLOCK, "BadWouldBlock", "Non blocking behaviour is required and the operation would block."},
26643  {UA_STATUSCODE_BADSYNTAXERROR, "BadSyntaxError", "A value had an invalid syntax."},
26644  {UA_STATUSCODE_BADMAXCONNECTIONSREACHED, "BadMaxConnectionsReached", "The operation could not be finished because all available connections are in use."},
26645  {0xffffffff, "Unknown", "Unknown StatusCode"},
26646 };
26647 #endif
26648 
26651  for(size_t i = 0; i < statusCodeDescriptionsSize; ++i) {
26652  if(statusCodeDescriptions[i].code == code)
26653  return &statusCodeDescriptions[i];
26654  }
26655  return &statusCodeDescriptions[statusCodeDescriptionsSize-1];
26656 }
26657 
26658 
26659 /*********************************** amalgamated original file "/home/iosb/sw/open62541/plugins/ua_network_tcp.c" ***********************************/
26660 
26661 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
26662  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
26663 
26664 #if defined(__MINGW32__) && (!defined(WINVER) || WINVER < 0x501)
26665 /* Assume the target is newer than Windows XP */
26666 # undef WINVER
26667 # undef _WIN32_WINDOWS
26668 # undef _WIN32_WINNT
26669 # define WINVER 0x0501
26670 # define _WIN32_WINDOWS 0x0501
26671 # define _WIN32_WINNT 0x0501
26672 #endif
26673 
26674 
26675 #include <stdlib.h> // malloc, free
26676 #include <stdio.h> // snprintf
26677 #include <string.h> // memset
26678 #include <errno.h>
26679 #ifdef _WIN32
26680 # ifndef __clang__
26681 # include <malloc.h>
26682 # endif
26683 /* Fix redefinition of SLIST_ENTRY on mingw winnt.h */
26684 # ifdef SLIST_ENTRY
26685 # undef SLIST_ENTRY
26686 # endif
26687 /* inet_ntoa is deprecated on MSVC but used for compatibility */
26688 # define _WINSOCK_DEPRECATED_NO_WARNINGS
26689 # include <winsock2.h>
26690 # include <ws2tcpip.h>
26691 # define CLOSESOCKET(S) closesocket((SOCKET)S)
26692 # define ssize_t int
26693 # define WIN32_INT (int)
26694 #else
26695 # define CLOSESOCKET(S) close(S)
26696 # define SOCKET int
26697 # define WIN32_INT
26698 # include <arpa/inet.h>
26699 # include <netinet/in.h>
26700 # include <sys/select.h>
26701 # include <sys/ioctl.h>
26702 # include <fcntl.h>
26703 # include <unistd.h> // read, write, close
26704 # include <netdb.h>
26705 # ifdef __QNX__
26706 # include <sys/socket.h>
26707 # endif
26708 #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
26709 # include <sys/param.h>
26710 # if defined(BSD)
26711 # include<sys/socket.h>
26712 # endif
26713 #endif
26714 # ifndef __CYGWIN__
26715 # include <netinet/tcp.h>
26716 # endif
26717 #endif
26718 
26719 /* unsigned int for windows and workaround to a glibc bug */
26720 /* Additionally if GNU_LIBRARY is not defined, it may be using musl libc (e.g. Docker Alpine) */
26721 #if defined(_WIN32) || defined(__OpenBSD__) || \
26722  (defined(__GNU_LIBRARY__) && (__GNU_LIBRARY__ <= 6) && \
26723  (__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 16) || \
26724  !defined(__GNU_LIBRARY__))
26725 # define UA_fd_set(fd, fds) FD_SET((unsigned int)fd, fds)
26726 # define UA_fd_isset(fd, fds) FD_ISSET((unsigned int)fd, fds)
26727 #else
26728 # define UA_fd_set(fd, fds) FD_SET(fd, fds)
26729 # define UA_fd_isset(fd, fds) FD_ISSET(fd, fds)
26730 #endif
26731 
26732 #ifdef UA_ENABLE_MULTITHREADING
26733 # include <urcu/uatomic.h>
26734 #endif
26735 
26736 #ifdef _WIN32
26737 #define errno__ WSAGetLastError()
26738 # define INTERRUPTED WSAEINTR
26739 # define WOULDBLOCK WSAEWOULDBLOCK
26740 # define AGAIN WSAEWOULDBLOCK
26741 #else
26742 # define errno__ errno
26743 # define INTERRUPTED EINTR
26744 # define WOULDBLOCK EWOULDBLOCK
26745 # define AGAIN EAGAIN
26746 #endif
26747 
26748 /****************************/
26749 /* Generic Socket Functions */
26750 /****************************/
26751 
26752 static void
26753 socket_close(UA_Connection *connection) {
26754  connection->state = UA_CONNECTION_CLOSED;
26755  shutdown((SOCKET)connection->sockfd,2);
26756  CLOSESOCKET(connection->sockfd);
26757 }
26758 
26759 static UA_StatusCode
26760 socket_write(UA_Connection *connection, UA_ByteString *buf) {
26761  size_t nWritten = 0;
26762  int flags = 0;
26763 #ifdef MSG_NOSIGNAL
26764  flags = MSG_NOSIGNAL;
26765 #endif
26766  do {
26767  ssize_t n = 0;
26768  do {
26769  /* If the OS throws EMSGSIZE, force a smaller packet size:
26770  * size_t bytes_to_send = buf->length - nWritten > 1024 ? 1024 : buf->length - nWritten; */
26771  size_t bytes_to_send = buf->length - nWritten;
26772  n = send((SOCKET)connection->sockfd, (const char*)buf->data + nWritten,
26773  WIN32_INT bytes_to_send, flags);
26774  if(n < 0 && errno__ != INTERRUPTED && errno__ != AGAIN) {
26775  connection->close(connection);
26776  socket_close(connection);
26777  UA_ByteString_deleteMembers(buf);
26779  }
26780  } while(n < 0);
26781  nWritten += (size_t)n;
26782  } while(nWritten < buf->length);
26783  UA_ByteString_deleteMembers(buf);
26784  return UA_STATUSCODE_GOOD;
26785 }
26786 
26787 static UA_StatusCode
26788 socket_recv(UA_Connection *connection, UA_ByteString *response, UA_UInt32 timeout) {
26789  response->data = malloc(connection->localConf.recvBufferSize);
26790  if(!response->data) {
26791  response->length = 0;
26792  return UA_STATUSCODE_BADOUTOFMEMORY; /* not enough memory retry */
26793  }
26794 
26795  if(timeout > 0) {
26796  /* currently, only the client uses timeouts */
26797 #ifndef _WIN32
26798  UA_UInt32 timeout_usec = timeout * 1000;
26799 # ifdef __APPLE__
26800  struct timeval tmptv = {(long int)(timeout_usec / 1000000), timeout_usec % 1000000};
26801 # else
26802  struct timeval tmptv = {(long int)(timeout_usec / 1000000), (long int)(timeout_usec % 1000000)};
26803 # endif
26804  int ret = setsockopt(connection->sockfd, SOL_SOCKET, SO_RCVTIMEO,
26805  (const char *)&tmptv, sizeof(struct timeval));
26806 #else
26807  DWORD timeout_dw = timeout;
26808  int ret = setsockopt(connection->sockfd, SOL_SOCKET, SO_RCVTIMEO,
26809  (const char*)&timeout_dw, sizeof(DWORD));
26810 #endif
26811  if(0 != ret) {
26812  UA_ByteString_deleteMembers(response);
26813  socket_close(connection);
26815  }
26816  }
26817 
26818 #ifdef __CYGWIN__
26819  /* Workaround for https://cygwin.com/ml/cygwin/2013-07/msg00107.html */
26820  ssize_t ret;
26821  if(timeout > 0) {
26822  fd_set fdset;
26823  FD_ZERO(&fdset);
26824  UA_fd_set(connection->sockfd, &fdset);
26825  UA_UInt32 timeout_usec = timeout * 1000;
26826  struct timeval tmptv = {(long int)(timeout_usec / 1000000),
26827  (long int)(timeout_usec % 1000000)};
26828  int retval = select(connection->sockfd+1, &fdset, NULL, NULL, &tmptv);
26829  if(retval && UA_fd_isset(connection->sockfd, &fdset)) {
26830  ret = recv(connection->sockfd, (char*)response->data,
26831  connection->localConf.recvBufferSize, 0);
26832  } else {
26833  ret = 0;
26834  }
26835  } else {
26836  ret = recv(connection->sockfd, (char*)response->data,
26837  connection->localConf.recvBufferSize, 0);
26838  }
26839 #else
26840  ssize_t ret = recv(connection->sockfd, (char*)response->data,
26841  connection->localConf.recvBufferSize, 0);
26842 #endif
26843 
26844  /* server has closed the connection */
26845  if(ret == 0) {
26846  UA_ByteString_deleteMembers(response);
26847  socket_close(connection);
26849  }
26850 
26851  /* error case */
26852  if(ret < 0) {
26853  UA_ByteString_deleteMembers(response);
26854  if(errno__ == INTERRUPTED || (timeout > 0) ?
26855  false : (errno__ == EAGAIN || errno__ == WOULDBLOCK))
26856  return UA_STATUSCODE_GOOD; /* statuscode_good but no data -> retry */
26857  socket_close(connection);
26859  }
26860 
26861  /* default case */
26862  response->length = (size_t)ret;
26863  return UA_STATUSCODE_GOOD;
26864 }
26865 
26866 static UA_StatusCode socket_set_nonblocking(SOCKET sockfd) {
26867 #ifdef _WIN32
26868  u_long iMode = 1;
26869  if(ioctlsocket(sockfd, FIONBIO, &iMode) != NO_ERROR)
26871 #else
26872  int opts = fcntl(sockfd, F_GETFL);
26873  if(opts < 0 || fcntl(sockfd, F_SETFL, opts|O_NONBLOCK) < 0)
26875 #endif
26876  return UA_STATUSCODE_GOOD;
26877 }
26878 
26879 static void FreeConnectionCallback(UA_Server *server, void *ptr) {
26881  free(ptr);
26882  }
26883 
26884 /***************************/
26885 /* Server NetworkLayer TCP */
26886 /***************************/
26887 
26921 #define MAXBACKLOG 100
26922 
26923 typedef struct {
26926  UA_Logger logger; // Set during start
26927 
26928  /* open sockets and connections */
26934  } *mappings;
26936 
26937 static UA_StatusCode
26938 ServerNetworkLayerGetSendBuffer(UA_Connection *connection, size_t length, UA_ByteString *buf) {
26939  if(length > connection->remoteConf.recvBufferSize)
26941  return UA_ByteString_allocBuffer(buf, length);
26942 }
26943 
26944 static void
26945 ServerNetworkLayerReleaseSendBuffer(UA_Connection *connection, UA_ByteString *buf) {
26946  UA_ByteString_deleteMembers(buf);
26947 }
26948 
26949 static void
26950 ServerNetworkLayerReleaseRecvBuffer(UA_Connection *connection, UA_ByteString *buf) {
26951  UA_ByteString_deleteMembers(buf);
26952 }
26953 
26954 /* after every select, we need to reset the sockets we want to listen on */
26955 static UA_Int32
26956 setFDSet(ServerNetworkLayerTCP *layer, fd_set *fdset) {
26957  FD_ZERO(fdset);
26958  UA_fd_set(layer->serversockfd, fdset);
26959  UA_Int32 highestfd = layer->serversockfd;
26960  for(size_t i = 0; i < layer->mappingsSize; ++i) {
26961  UA_fd_set(layer->mappings[i].sockfd, fdset);
26962  if(layer->mappings[i].sockfd > highestfd)
26963  highestfd = layer->mappings[i].sockfd;
26964  }
26965  return highestfd;
26966 }
26967 
26968 /* callback triggered from the server */
26969 static void
26970 ServerNetworkLayerTCP_closeConnection(UA_Connection *connection) {
26971 #ifdef UA_ENABLE_MULTITHREADING
26972  if(uatomic_xchg(&connection->state, UA_CONNECTION_CLOSED) == UA_CONNECTION_CLOSED)
26973  return;
26974 #else
26975  if(connection->state == UA_CONNECTION_CLOSED)
26976  return;
26977  connection->state = UA_CONNECTION_CLOSED;
26978 #endif
26979 #if UA_LOGLEVEL <= 300
26980  //cppcheck-suppress unreadVariable
26981  ServerNetworkLayerTCP *layer = connection->handle;
26982  UA_LOG_INFO(layer->logger, UA_LOGCATEGORY_NETWORK,
26983  "Connection %i | Force closing the connection",
26984  connection->sockfd);
26985 #endif
26986  /* only "shutdown" here. this triggers the select, where the socket is
26987  "closed" in the mainloop */
26988  shutdown(connection->sockfd, 2);
26989 }
26990 
26991 /* call only from the single networking thread */
26992 static UA_StatusCode
26993 ServerNetworkLayerTCP_add(ServerNetworkLayerTCP *layer, UA_Int32 newsockfd) {
26994  UA_Connection *c = malloc(sizeof(UA_Connection));
26995  if(!c)
26997 
26998  struct sockaddr_in addr;
26999  socklen_t addrlen = sizeof(struct sockaddr_in);
27000  int res = getpeername(newsockfd, (struct sockaddr*)&addr, &addrlen);
27001 
27002  if(res == 0) {
27003  UA_LOG_INFO(layer->logger, UA_LOGCATEGORY_NETWORK,
27004  "Connection %i | New connection over TCP from %s:%d",
27005  newsockfd, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
27006  } else {
27007  UA_LOG_WARNING(layer->logger, UA_LOGCATEGORY_NETWORK,
27008  "Connection %i | New connection over TCP, "
27009  "getpeername failed with errno %i", newsockfd, errno);
27010  }
27011 
27012  memset(c, 0, sizeof(UA_Connection));
27013  c->sockfd = newsockfd;
27014  c->handle = layer;
27015  c->localConf = layer->conf;
27016  c->remoteConf = layer->conf;
27017  c->send = socket_write;
27018  c->close = ServerNetworkLayerTCP_closeConnection;
27019  c->getSendBuffer = ServerNetworkLayerGetSendBuffer;
27020  c->releaseSendBuffer = ServerNetworkLayerReleaseSendBuffer;
27021  c->releaseRecvBuffer = ServerNetworkLayerReleaseRecvBuffer;
27023  struct ConnectionMapping *nm;
27024  nm = realloc(layer->mappings,
27025  sizeof(struct ConnectionMapping)*(layer->mappingsSize+1));
27026  if(!nm) {
27027  UA_LOG_ERROR(layer->logger, UA_LOGCATEGORY_NETWORK,
27028  "No memory for a new Connection");
27029  free(c);
27031  }
27032  layer->mappings = nm;
27033  layer->mappings[layer->mappingsSize].connection = c;
27034  layer->mappings[layer->mappingsSize].sockfd = newsockfd;
27035  ++layer->mappingsSize;
27036  return UA_STATUSCODE_GOOD;
27037 }
27038 
27039 static UA_StatusCode
27040 ServerNetworkLayerTCP_start(UA_ServerNetworkLayer *nl, UA_Logger logger) {
27041  ServerNetworkLayerTCP *layer = nl->handle;
27042  layer->logger = logger;
27043 
27044  /* get the discovery url from the hostname */
27046  char hostname[256];
27047  if(gethostname(hostname, 255) == 0) {
27048  char discoveryUrl[256];
27049 #ifndef _MSC_VER
27050  du.length = (size_t)snprintf(discoveryUrl, 255, "opc.tcp://%s:%d",
27051  hostname, layer->port);
27052 #else
27053  du.length = (size_t)_snprintf_s(discoveryUrl, 255, _TRUNCATE,
27054  "opc.tcp://%s:%d", hostname, layer->port);
27055 #endif
27056  du.data = (UA_Byte*)discoveryUrl;
27057  }
27058  UA_String_copy(&du, &nl->discoveryUrl);
27059 
27060  /* Create the server socket */
27061  SOCKET newsock = socket(PF_INET, SOCK_STREAM, 0);
27062 #ifdef _WIN32
27063  if(newsock == INVALID_SOCKET)
27064 #else
27065  if(newsock < 0)
27066 #endif
27067  {
27068  UA_LOG_WARNING(layer->logger, UA_LOGCATEGORY_NETWORK,
27069  "Error opening the server socket");
27071  }
27072 
27073  /* Set socket options */
27074  int optval = 1;
27075  if(setsockopt(newsock, SOL_SOCKET, SO_REUSEADDR,
27076  (const char *)&optval, sizeof(optval)) == -1 ||
27077  socket_set_nonblocking(newsock) != UA_STATUSCODE_GOOD) {
27078  UA_LOG_WARNING(layer->logger, UA_LOGCATEGORY_NETWORK,
27079  "Error during setting of server socket options");
27080  CLOSESOCKET(newsock);
27082  }
27083 
27084  /* Bind socket to address */
27085  const struct sockaddr_in serv_addr = {
27086  .sin_family = AF_INET, .sin_addr.s_addr = INADDR_ANY,
27087  .sin_port = htons(layer->port), .sin_zero = {0}};
27088  if(bind(newsock, (const struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
27089  UA_LOG_WARNING(layer->logger, UA_LOGCATEGORY_NETWORK,
27090  "Error during binding of the server socket");
27091  CLOSESOCKET(newsock);
27093  }
27094 
27095  /* Start listening */
27096  if(listen(newsock, MAXBACKLOG) < 0) {
27097  UA_LOG_WARNING(layer->logger, UA_LOGCATEGORY_NETWORK,
27098  "Error listening on server socket");
27099  CLOSESOCKET(newsock);
27101  }
27102 
27103  layer->serversockfd = (UA_Int32)newsock; /* cast on win32 */
27104  UA_LOG_INFO(layer->logger, UA_LOGCATEGORY_NETWORK,
27105  "TCP network layer listening on %.*s",
27107  return UA_STATUSCODE_GOOD;
27108 }
27109 
27110 static size_t
27111 removeClosedConnections(ServerNetworkLayerTCP *layer, UA_Job *js) {
27112  size_t c = 0;
27113  for(size_t i = 0; i < layer->mappingsSize; ++i) {
27114  if(layer->mappings[i].connection &&
27116  continue;
27117  /* the socket was closed from remote */
27118  UA_Connection *conn = layer->mappings[i].connection;
27119  js[c].type = UA_JOBTYPE_DETACHCONNECTION;
27120  js[c].job.closeConnection = conn;
27121  layer->mappings[i] = layer->mappings[layer->mappingsSize-1];
27122  --layer->mappingsSize;
27123  ++c;
27124  js[c].type = UA_JOBTYPE_METHODCALL_DELAYED;
27125  js[c].job.methodCall.method = FreeConnectionCallback;
27126  js[c].job.methodCall.data = conn;
27127  ++c;
27128  }
27129  return c;
27130 }
27131 
27132 static size_t
27133 ServerNetworkLayerTCP_getJobs(UA_ServerNetworkLayer *nl, UA_Job **jobs,
27134  UA_UInt16 timeout) {
27135  /* Every open socket can generate two jobs */
27136  ServerNetworkLayerTCP *layer = nl->handle;
27137  UA_Job *js = malloc(sizeof(UA_Job) * (size_t)((layer->mappingsSize * 2)));
27138  if(!js)
27140 
27141  /* Remove closed sockets */
27142  size_t totalJobs = removeClosedConnections(layer, js);
27143 
27144  /* Listen on open sockets (including the server) */
27145  fd_set fdset, errset;
27146  UA_Int32 highestfd = setFDSet(layer, &fdset);
27147  setFDSet(layer, &errset);
27148  struct timeval tmptv = {0, timeout * 1000};
27149  UA_Int32 resultsize = select(highestfd+1, &fdset, NULL, &errset, &tmptv);
27150  if(totalJobs == 0 && resultsize <= 0) {
27151  free(js);
27152  *jobs = NULL;
27153  return 0;
27154  }
27155 
27156  /* Accept new connection via the server socket (can only be a single one) */
27157  if(UA_fd_isset(layer->serversockfd, &fdset)) {
27158  --resultsize;
27159  SOCKET newsockfd = accept((SOCKET)layer->serversockfd, NULL, NULL);
27160 #ifdef _WIN32
27161  if(newsockfd != INVALID_SOCKET)
27162 #else
27163  if(newsockfd >= 0)
27164 #endif
27165  {
27166  socket_set_nonblocking(newsockfd);
27167  /* Do not merge packets on the socket (disable Nagle's algorithm) */
27168  int i = 1;
27169  setsockopt(newsockfd, IPPROTO_TCP, TCP_NODELAY, (void *)&i, sizeof(i));
27170  ServerNetworkLayerTCP_add(layer, (UA_Int32)newsockfd);
27171  }
27172  }
27173 
27174  /* Read from established sockets */
27176  size_t j = 0;
27177  for(size_t i = 0; i < layer->mappingsSize && j < (size_t)resultsize; ++i) {
27178  if(!UA_fd_isset(layer->mappings[i].sockfd, &errset) &&
27179  !UA_fd_isset(layer->mappings[i].sockfd, &fdset))
27180  continue;
27181 
27182  UA_StatusCode retval = socket_recv(layer->mappings[i].connection, &buf, 0);
27183  if(retval == UA_STATUSCODE_GOOD) {
27184  js[totalJobs + j].job.binaryMessage.connection = layer->mappings[i].connection;
27185  js[totalJobs + j].job.binaryMessage.message = buf;
27186  js[totalJobs + j].type = UA_JOBTYPE_BINARYMESSAGE_NETWORKLAYER;
27187  ++j;
27188  } else if (retval == UA_STATUSCODE_BADCONNECTIONCLOSED) {
27189  UA_Connection *c = layer->mappings[i].connection;
27190  UA_LOG_INFO(layer->logger, UA_LOGCATEGORY_NETWORK,
27191  "Connection %i | Connection closed from remote", c->sockfd);
27192  /* the socket was closed from remote */
27193  js[totalJobs + j].type = UA_JOBTYPE_DETACHCONNECTION;
27194  js[totalJobs + j].job.closeConnection = c;
27195  layer->mappings[i] = layer->mappings[layer->mappingsSize-1];
27196  --layer->mappingsSize;
27197  ++totalJobs; /* increase j only once */
27198  js[totalJobs + j].type = UA_JOBTYPE_METHODCALL_DELAYED;
27199  js[totalJobs + j].job.methodCall.method = FreeConnectionCallback;
27200  js[totalJobs + j].job.methodCall.data = c;
27201  ++j;
27202  }
27203  }
27204  totalJobs += j;
27205 
27206  if(totalJobs == 0) {
27207  free(js);
27208  js = NULL;
27209  }
27210  *jobs = js;
27211  return totalJobs;
27212 }
27213 
27214 static size_t
27215 ServerNetworkLayerTCP_stop(UA_ServerNetworkLayer *nl, UA_Job **jobs) {
27216  ServerNetworkLayerTCP *layer = nl->handle;
27217  UA_LOG_INFO(layer->logger, UA_LOGCATEGORY_NETWORK,
27218  "Shutting down the TCP network layer with %d open connection(s)",
27219  layer->mappingsSize);
27220  shutdown((SOCKET)layer->serversockfd,2);
27221  CLOSESOCKET(layer->serversockfd);
27222  UA_Job *items = malloc(sizeof(UA_Job) * layer->mappingsSize * 2);
27223  if(!items)
27224  return 0;
27225  for(size_t i = 0; i < layer->mappingsSize; ++i) {
27226  socket_close(layer->mappings[i].connection);
27227  items[i*2].type = UA_JOBTYPE_DETACHCONNECTION;
27228  items[i*2].job.closeConnection = layer->mappings[i].connection;
27229  items[(i*2)+1].type = UA_JOBTYPE_METHODCALL_DELAYED;
27230  items[(i*2)+1].job.methodCall.method = FreeConnectionCallback;
27231  items[(i*2)+1].job.methodCall.data = layer->mappings[i].connection;
27232  }
27233 #ifdef _WIN32
27234  WSACleanup();
27235 #endif
27236  *jobs = items;
27237  return layer->mappingsSize*2;
27238 }
27239 
27240 /* run only when the server is stopped */
27241 static void ServerNetworkLayerTCP_deleteMembers(UA_ServerNetworkLayer *nl) {
27242  ServerNetworkLayerTCP *layer = nl->handle;
27243  free(layer->mappings);
27244  free(layer);
27245  UA_String_deleteMembers(&nl->discoveryUrl);
27246 }
27247 
27250 #ifdef _WIN32
27251  WORD wVersionRequested;
27252  WSADATA wsaData;
27253  wVersionRequested = MAKEWORD(2, 2);
27254  WSAStartup(wVersionRequested, &wsaData);
27255 #endif
27256 
27258  memset(&nl, 0, sizeof(UA_ServerNetworkLayer));
27259  ServerNetworkLayerTCP *layer = calloc(1,sizeof(ServerNetworkLayerTCP));
27260  if(!layer)
27261  return nl;
27262 
27263  layer->conf = conf;
27264  layer->port = port;
27265 
27266  nl.handle = layer;
27267  nl.start = ServerNetworkLayerTCP_start;
27268  nl.getJobs = ServerNetworkLayerTCP_getJobs;
27269  nl.stop = ServerNetworkLayerTCP_stop;
27270  nl.deleteMembers = ServerNetworkLayerTCP_deleteMembers;
27271  return nl;
27272 }
27273 
27274 /***************************/
27275 /* Client NetworkLayer TCP */
27276 /***************************/
27277 
27278 static UA_StatusCode
27279 ClientNetworkLayerGetBuffer(UA_Connection *connection, size_t length,
27280  UA_ByteString *buf) {
27281  if(length > connection->remoteConf.recvBufferSize)
27283  if(connection->state == UA_CONNECTION_CLOSED)
27285  return UA_ByteString_allocBuffer(buf, connection->remoteConf.recvBufferSize);
27286 }
27287 
27288 static void
27289 ClientNetworkLayerReleaseBuffer(UA_Connection *connection, UA_ByteString *buf) {
27290  UA_ByteString_deleteMembers(buf);
27291 }
27292 
27293 static void
27294 ClientNetworkLayerClose(UA_Connection *connection) {
27295 #ifdef UA_ENABLE_MULTITHREADING
27296  if(uatomic_xchg(&connection->state, UA_CONNECTION_CLOSED) == UA_CONNECTION_CLOSED)
27297  return;
27298 #else
27299  if(connection->state == UA_CONNECTION_CLOSED)
27300  return;
27301  connection->state = UA_CONNECTION_CLOSED;
27302 #endif
27303  socket_close(connection);
27304 }
27305 
27306 /* we have no networklayer. instead, attach the reusable buffer to the handle */
27308 UA_ClientConnectionTCP(UA_ConnectionConfig conf, const char *endpointUrl,
27309  UA_Logger logger) {
27310 #ifdef _WIN32
27311  WORD wVersionRequested;
27312  WSADATA wsaData;
27313  wVersionRequested = MAKEWORD(2, 2);
27314  WSAStartup(wVersionRequested, &wsaData);
27315 #endif
27316 
27317  UA_Connection connection;
27318  memset(&connection, 0, sizeof(UA_Connection));
27319  connection.state = UA_CONNECTION_OPENING;
27320  connection.localConf = conf;
27321  connection.remoteConf = conf;
27322  connection.send = socket_write;
27323  connection.recv = socket_recv;
27324  connection.close = ClientNetworkLayerClose;
27325  connection.getSendBuffer = ClientNetworkLayerGetBuffer;
27326  connection.releaseSendBuffer = ClientNetworkLayerReleaseBuffer;
27327  connection.releaseRecvBuffer = ClientNetworkLayerReleaseBuffer;
27328 
27329  char hostname[512];
27330  UA_UInt16 port = 0;
27331  const char *path = NULL;
27332 
27333  UA_StatusCode parse_retval = UA_EndpointUrl_split(endpointUrl, hostname, &port, &path);
27334  if(parse_retval != UA_STATUSCODE_GOOD) {
27335  if(parse_retval == UA_STATUSCODE_BADOUTOFRANGE)
27336  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27337  "Server url is invalid: %s", endpointUrl);
27338  else if(parse_retval == UA_STATUSCODE_BADATTRIBUTEIDINVALID)
27339  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27340  "Server url does not begin with 'opc.tcp://' '%s'",
27341  endpointUrl);
27342  return connection;
27343  }
27344 
27345  if(port == 0) {
27346  port = 4840;
27347  UA_LOG_INFO(logger, UA_LOGCATEGORY_NETWORK,
27348  "No port defined, using standard port %d", port);
27349  }
27350 
27351  struct addrinfo hints, *server;
27352  memset(&hints, 0, sizeof(hints));
27353  hints.ai_socktype = SOCK_STREAM;
27354  hints.ai_family = AF_INET;
27355  char portStr[6];
27356 #ifndef _MSC_VER
27357  snprintf(portStr, 6, "%d", port);
27358 #else
27359  _snprintf_s(portStr, 6, _TRUNCATE, "%d", port);
27360 #endif
27361  int error = getaddrinfo(hostname, portStr, &hints, &server);
27362  if(error != 0 || !server) {
27363  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27364  "DNS lookup of %s failed with error %s",
27365  hostname, gai_strerror(error));
27366  return connection;
27367  }
27368 
27369  /* Get a socket */
27370  SOCKET clientsockfd = socket(server->ai_family, server->ai_socktype,
27371  server->ai_protocol);
27372 #ifdef _WIN32
27373  if(clientsockfd == INVALID_SOCKET) {
27374 #else
27375  if(clientsockfd < 0) {
27376 #endif
27377  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27378  "Could not create client socket");
27379  freeaddrinfo(server);
27380  return connection;
27381  }
27382 
27383  /* Connect to the server */
27384  connection.sockfd = (UA_Int32)clientsockfd; /* cast for win32 */
27385  error = connect(clientsockfd, server->ai_addr, WIN32_INT server->ai_addrlen);
27386  freeaddrinfo(server);
27387  if(error < 0) {
27388  ClientNetworkLayerClose(&connection);
27389 #ifdef _WIN32
27390  wchar_t *s = NULL;
27391  FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
27392  FORMAT_MESSAGE_FROM_SYSTEM |
27393  FORMAT_MESSAGE_IGNORE_INSERTS,
27394  NULL, WSAGetLastError(),
27395  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
27396  (LPWSTR)&s, 0, NULL);
27397  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27398  "Connection to %s failed. Error: %d: %S",
27399  endpointUrl, WSAGetLastError(), s);
27400  LocalFree(s);
27401 #else
27402  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27403  "Connection to %s failed. Error: %d: %s",
27404  endpointUrl, errno, strerror(errno));
27405 #endif
27406  return connection;
27407  }
27408 
27409 #ifdef SO_NOSIGPIPE
27410  int val = 1;
27411  int sso_result = setsockopt(connection.sockfd,
27412  SOL_SOCKET, SO_NOSIGPIPE,
27413  (void*)&val, sizeof(val));
27414  if(sso_result < 0)
27415  UA_LOG_WARNING(logger, UA_LOGCATEGORY_NETWORK,
27416  "Couldn't set SO_NOSIGPIPE");
27417 #endif
27418 
27419  return connection;
27420 }
27421 
27422 /*********************************** amalgamated original file "/home/iosb/sw/open62541/plugins/ua_clock.c" ***********************************/
27423 
27424 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
27425  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
27426 
27427 
27428 #include <time.h>
27429 #ifdef _WIN32
27430 # ifdef SLIST_ENTRY
27431 # undef SLIST_ENTRY /* Fix redefinition of SLIST_ENTRY on mingw winnt.h */
27432 # endif
27433 # include <windows.h>
27434 #else
27435 # include <sys/time.h>
27436 #endif
27437 
27438 #if defined(__APPLE__) || defined(__MACH__)
27439 # include <mach/clock.h>
27440 # include <mach/mach.h>
27441 #endif
27442 
27444 #if defined(_WIN32)
27445  /* Windows filetime has the same definition as UA_DateTime */
27446  FILETIME ft;
27447  SYSTEMTIME st;
27448  GetSystemTime(&st);
27449  SystemTimeToFileTime(&st, &ft);
27450  ULARGE_INTEGER ul;
27451  ul.LowPart = ft.dwLowDateTime;
27452  ul.HighPart = ft.dwHighDateTime;
27453  return (UA_DateTime)ul.QuadPart;
27454 #else
27455  struct timeval tv;
27456  gettimeofday(&tv, NULL);
27457  return (tv.tv_sec * UA_SEC_TO_DATETIME) + (tv.tv_usec * UA_USEC_TO_DATETIME) + UA_DATETIME_UNIX_EPOCH;
27458 #endif
27459 }
27460 
27462 #if defined(_WIN32)
27463  LARGE_INTEGER freq, ticks;
27464  QueryPerformanceFrequency(&freq);
27465  QueryPerformanceCounter(&ticks);
27466  UA_Double ticks2dt = UA_SEC_TO_DATETIME / (UA_Double)freq.QuadPart;
27467  return (UA_DateTime)(ticks.QuadPart * ticks2dt);
27468 #elif defined(__APPLE__) || defined(__MACH__)
27469  /* OS X does not have clock_gettime, use clock_get_time */
27470  clock_serv_t cclock;
27471  mach_timespec_t mts;
27472  host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock);
27473  clock_get_time(cclock, &mts);
27474  mach_port_deallocate(mach_task_self(), cclock);
27475  return (mts.tv_sec * UA_SEC_TO_DATETIME) + (mts.tv_nsec / 100);
27476 #elif !defined(CLOCK_MONOTONIC_RAW)
27477  struct timespec ts;
27478  clock_gettime(CLOCK_MONOTONIC, &ts);
27479  return (ts.tv_sec * UA_SEC_TO_DATETIME) + (ts.tv_nsec / 100);
27480 #else
27481  struct timespec ts;
27482  clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
27483  return (ts.tv_sec * UA_SEC_TO_DATETIME) + (ts.tv_nsec / 100);
27484 #endif
27485 }
27486 
27487 /*********************************** amalgamated original file "/home/iosb/sw/open62541/plugins/ua_log_stdout.c" ***********************************/
27488 
27489 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
27490  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
27491 
27492 #include <stdio.h>
27493 #include <stdarg.h>
27494 
27495 #ifdef UA_ENABLE_MULTITHREADING
27496 #include <pthread.h>
27497 static pthread_mutex_t printf_mutex = PTHREAD_MUTEX_INITIALIZER;
27498 #endif
27499 
27500 const char *LogLevelNames[6] = {"trace", "debug", "info", "warning", "error", "fatal"};
27501 const char *LogCategoryNames[6] = {"network", "channel", "session", "server", "client", "userland"};
27502 
27503 #if (defined(__GNUC__) && defined(__GNUC_MINOR__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6) || \
27504  defined(__clang__)
27505 # pragma GCC diagnostic push
27506 # pragma GCC diagnostic ignored "-Wformat-nonliteral"
27507 #endif
27508 
27509 void
27511  const char *msg, va_list args) {
27513 #ifdef UA_ENABLE_MULTITHREADING
27514  pthread_mutex_lock(&printf_mutex);
27515 #endif
27516  printf("[%.23s] %s/%s\t", t.data, LogLevelNames[level], LogCategoryNames[category]);
27517  vprintf(msg, args);
27518  printf("\n");
27519  fflush(stdout);
27520 #ifdef UA_ENABLE_MULTITHREADING
27521  pthread_mutex_unlock(&printf_mutex);
27522 #endif
27523  UA_ByteString_deleteMembers(&t);
27524 }
27525 
27526 #if (defined(__GNUC__) && defined(__GNUC_MINOR__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6) || \
27527  defined(__clang__)
27528 # pragma GCC diagnostic pop
27529 #endif
27530 
27531 /*********************************** amalgamated original file "/home/iosb/sw/open62541/plugins/ua_config_standard.c" ***********************************/
27532 
27533 /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
27534  * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
27535 
27536 
27537 /*******************************/
27538 /* Default Connection Settings */
27539 /*******************************/
27540 
27542  .protocolVersion = 0,
27543  .sendBufferSize = 65535, /* 64k per chunk */
27544  .recvBufferSize = 65535, /* 64k per chunk */
27545  .maxMessageSize = 0, /* 0 -> unlimited */
27546  .maxChunkCount = 0 /* 0 -> unlimited */
27547 };
27548 
27549 /***************************/
27550 /* Default Server Settings */
27551 /***************************/
27552 
27553 #define MANUFACTURER_NAME "open62541"
27554 #define PRODUCT_NAME "open62541 OPC UA Server"
27555 #define PRODUCT_URI "http://open62541.org"
27556 #define APPLICATION_NAME "open62541-based OPC UA Application"
27557 #define APPLICATION_URI "urn:unconfigured:application"
27558 
27559 #define UA_STRING_STATIC(s) {sizeof(s)-1, (UA_Byte*)s}
27560 #define UA_STRING_STATIC_NULL {0, NULL}
27561 
27562 #define STRINGIFY(arg) #arg
27563 #define VERSION(MAJOR, MINOR, PATCH, LABEL) \
27564  STRINGIFY(MAJOR) "." STRINGIFY(MINOR) "." STRINGIFY(PATCH) LABEL
27565 
27567  { UA_STRING_STATIC("user1"), UA_STRING_STATIC("password") },
27568  { UA_STRING_STATIC("user2"), UA_STRING_STATIC("password1") } };
27569 
27571  .nThreads = 1,
27572  .logger = UA_Log_Stdout,
27573 
27574  /* Server Description */
27575  .buildInfo = {
27576  .productUri = UA_STRING_STATIC(PRODUCT_URI),
27577  .manufacturerName = UA_STRING_STATIC(MANUFACTURER_NAME),
27578  .productName = UA_STRING_STATIC(PRODUCT_NAME),
27579  .softwareVersion = UA_STRING_STATIC(VERSION(UA_OPEN62541_VER_MAJOR,
27583  .buildNumber = UA_STRING_STATIC(__DATE__ " " __TIME__),
27584  .buildDate = 0 },
27585  .applicationDescription = {
27586  .applicationUri = UA_STRING_STATIC(APPLICATION_URI),
27587  .productUri = UA_STRING_STATIC(PRODUCT_URI),
27588  .applicationName = { .locale = UA_STRING_STATIC("en"),
27590  .applicationType = UA_APPLICATIONTYPE_SERVER,
27591  .gatewayServerUri = UA_STRING_STATIC_NULL,
27592  .discoveryProfileUri = UA_STRING_STATIC_NULL,
27593  .discoveryUrlsSize = 0,
27594  .discoveryUrls = NULL },
27595  .serverCertificate = UA_STRING_STATIC_NULL,
27596 
27597  /* Networking */
27598  .networkLayersSize = 0,
27599  .networkLayers = NULL,
27600 
27601  /* Login */
27602  .enableAnonymousLogin = true,
27603  .enableUsernamePasswordLogin = true,
27604  .usernamePasswordLogins = usernamePasswords,
27605  .usernamePasswordLoginsSize = 2,
27606 
27607  /* Limits for SecureChannels */
27608  .maxSecureChannels = 40,
27609  .maxSecurityTokenLifetime = 10 * 60 * 1000, /* 10 minutes */
27610 
27611  /* Limits for Sessions */
27612  .maxSessions = 100,
27613  .maxSessionTimeout = 60.0 * 60.0 * 1000.0, /* 1h */
27614 
27615  /* Limits for Subscriptions */
27616  .publishingIntervalLimits = { .min = 100.0, .max = 3600.0 * 1000.0 },
27617  .lifeTimeCountLimits = { .max = 15000, .min = 3 },
27618  .keepAliveCountLimits = { .max = 100, .min = 1 },
27619  .maxNotificationsPerPublish = 1000,
27620  .maxRetransmissionQueueSize = 0, /* unlimited */
27621 
27622  /* Limits for MonitoredItems */
27623  .samplingIntervalLimits = { .min = 50.0, .max = 24.0 * 3600.0 * 1000.0 },
27624  .queueSizeLimits = { .max = 100, .min = 1 }
27625 };
27626 
27627 /***************************/
27628 /* Default Client Settings */
27629 /***************************/
27630 
27631 const UA_EXPORT UA_ClientConfig UA_ClientConfig_standard = {
27632  .timeout = 5000, /* 5 seconds */
27633  .secureChannelLifeTime = 10 * 60 * 1000, /* 10 minutes */
27634  .logger = UA_Log_Stdout,
27635  .localConnectionConfig = {
27636  .protocolVersion = 0,
27637  .sendBufferSize = 65535, /* 64k per chunk */
27638  .recvBufferSize = 65535, /* 64k per chunk */
27639  .maxMessageSize = 0, /* 0 -> unlimited */
27640  .maxChunkCount = 0 /* 0 -> unlimited */
27641  },
27642  .connectionFunc = UA_ClientConnectionTCP
27643 };
27644 /****************************************/
27645 /* Default Client Subscription Settings */
27646 /****************************************/
27647 
27648 #ifdef UA_ENABLE_SUBSCRIPTIONS
27649 
27650 const UA_SubscriptionSettings UA_SubscriptionSettings_standard = {
27651  .requestedPublishingInterval = 500.0,
27652  .requestedLifetimeCount = 10000,
27653  .requestedMaxKeepAliveCount = 1,
27654  .maxNotificationsPerPublish = 10,
27655  .publishingEnabled = true,
27656  .priority = 0
27657 };
27658 
27659 #endif
UA_Int32 i32
Definition: open62541.c:778
UA_EndpointDescription * serverEndpoints
Definition: open62541.h:5159
UA_String * profileUris
Definition: open62541.h:4470
UA_SecureChannel * channel
Definition: open62541.h:9482
#define UA_NS0ID_BROWSENEXTREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2131
#define LIST_HEAD(name, type)
Definition: open62541.c:197
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXQUERYCONTINUATIONPOINTS
Definition: open62541.h:2612
#define UA_NS0ID_UNREGISTERNODESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2164
UA_StatusCode UA_Server_addReference(UA_Server *server, const UA_NodeId sourceId, const UA_NodeId refTypeId, const UA_ExpandedNodeId targetId, UA_Boolean isForward)
Definition: open62541.c:22319
void Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *session, const UA_TranslateBrowsePathsToNodeIdsRequest *request, UA_TranslateBrowsePathsToNodeIdsResponse *response)
Definition: open62541.c:23238
UA_StatusCode UA_Client_connect_username(UA_Client *client, const char *endpointUrl, const char *username, const char *password)
Definition: open62541.c:25245
UA_ResponseHeader responseHeader
Definition: open62541.h:4630
UA_NodeId authenticationToken
Definition: open62541.c:4743
#define UA_NS0ID_SERVERTYPE
Definition: open62541.h:2488
#define UA_STATUSCODE_BADSHELVINGTIMEOUTOFRANGE
Definition: open62541.h:835
UA_TimestampsToReturn timestampsToReturn
Definition: open62541.h:4531
#define UA_NS0ID_MODIFYMONITOREDITEMSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2361
WriteValue ^^^^^^^^^^.
Definition: open62541.h:3632
UA_StatusCode(* recv)(UA_Connection *connection, UA_ByteString *response, UA_UInt32 timeout)
Definition: open62541.h:9516
size_t continuationPointsSize
Definition: open62541.h:4217
#define UA_TYPES_SETMONITORINGMODERESPONSE
Definition: open62541.h:4550
UA_VariantStorageType storageType
Definition: open62541.h:1401
UA_SecureChannelManager secureChannelManager
Definition: open62541.c:4207
void UA_Variant_setScalar(UA_Variant *v, void *UA_RESTRICT p, const UA_DataType *type)
Definition: open62541.c:5155
#define UA_STATUSCODE_BADDEADBANDFILTERINVALID
Definition: open62541.h:814
#define UA_STATUSCODE_UNCERTAININITIALVALUE
Definition: open62541.h:818
#define UA_EXPORT
Function Export On Win32: Define UA_DYNAMIC_LINKING and UA_DYNAMIC_LINKING_EXPORT in order to export ...
Definition: open62541.h:143
#define FLOAT_NEG_ZERO
Definition: open62541.c:6166
UA_UInt32 requestHandle
Definition: open62541.h:3303
#define UA_NodeStore_newVariableTypeNode()
Definition: open62541.c:3995
#define UA_STATUSCODE_BADVIEWPARAMETERMISMATCH
Definition: open62541.h:771
UA_Byte eventNotifier
Definition: open62541.h:3270
#define UA_NS0ID_ENUMERATION
Definition: open62541.h:1824
UA_Boolean symmetric
Definition: open62541.c:3653
SequenceHeader ^^^^^^^^^^^^^^ Secure Layer Sequence Header.
Definition: open62541.c:2617
struct UA_ExtensionObject::@1::@2 encoded
uint32_t UA_UInt32
UInt32 ^^^^^^ An integer value between 0 and 4 294 967 295.
Definition: open62541.h:970
#define UA_TYPES_METHODATTRIBUTES
Definition: open62541.h:3612
size_t arrayLength
Definition: open62541.h:1402
#define UA_BINARY_OVERLAYABLE_INTEGER
String Manipulation The header string.h is defined in the C-standard.
Definition: open62541.h:247
#define UA_STATUSCODE_BADDEVICEFAILURE
Definition: open62541.h:811
UA_Session adminSession
Definition: open62541.c:15603
#define UA_NS0ID_FROMSTATE
Definition: open62541.h:1843
void UA_SecureChannel_revolveTokens(UA_SecureChannel *channel)
Definition: open62541.c:15249
UA_UInt32 maxMessageSize
Definition: open62541.c:2552
#define UA_NS0ID_SERVERSTATUSDATATYPE
Definition: open62541.h:2448
#define UA_TYPES_SIGNATUREDATA
Definition: open62541.h:3693
UA_ResponseHeader responseHeader
Definition: open62541.h:4934
#define UA_STATUSCODE_BADINSUFFICIENTCLIENTPROFILE
Definition: open62541.h:794
UA_QualifiedName targetName
Definition: open62541.h:3477
#define UA_STATUSCODE_BADEVENTFILTERINVALID
Definition: open62541.h:726
#define UA_NS0ID_BUILDINFO
Definition: open62541.h:1958
Definition: open62541.c:3706
#define container_of(ptr, type, member)
Definition: open62541.c:749
UA_StatusCode UA_Server_forEachChildNodeCall(UA_Server *server, UA_NodeId parentNodeId, UA_NodeIteratorCallback callback, void *handle)
Definition: open62541.c:15779
ApplicationDescription ^^^^^^^^^^^^^^^^^^^^^^ Describes an application and how to find it...
Definition: open62541.h:4906
#define UA_NS0ID_SERVER_VENDORSERVERINFO
Definition: open62541.h:2572
void Service_DeleteNodes(UA_Server *server, UA_Session *session, const UA_DeleteNodesRequest *request, UA_DeleteNodesResponse *response)
Definition: open62541.c:22377
UA_LogCategory
Definition: open62541.h:9639
UA_NodeId referenceTypeId
Definition: open62541.h:3474
UA_BrowsePathResult UA_Server_translateBrowsePathToNodeIds(UA_Server *server, const UA_BrowsePath *browsePath)
Definition: open62541.c:23228
#define NULL
#define UA_NodeStore_newVariableNode()
Definition: open62541.c:3989
size_t resultsSize
Definition: open62541.h:4202
#define UA_NS0ID_FINDSERVERSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2020
#define UA_TYPES_QUERYDATASET
Definition: open62541.h:3546
#define UA_OPEN62541_VER_LABEL
Definition: open62541.h:42
#define UA_STATUSCODE_BADSERVERNOTCONNECTED
Definition: open62541.h:666
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_MANUFACTURERNAME
Definition: open62541.h:2547
TcpMessageHeader ^^^^^^^^^^^^^^^^ TCP Header.
Definition: open62541.c:2628
#define UA_NS0ID_ORGANIZES
Definition: open62541.h:1830
#define UA_STATUSCODE_UNCERTAINDATASUBNORMAL
Definition: open62541.h:846
UA_ApplicationType
ApplicationType ^^^^^^^^^^^^^^^ The types of applications.
Definition: open62541.h:4097
const UA_EXPORT UA_ConnectionConfig UA_ConnectionConfig_standard
Definition: open62541.c:27541
UA_StatusCode UA_NodeStore_remove(UA_NodeStore *ns, const UA_NodeId *nodeid)
Definition: open62541.c:19452
UA_MonitoredItemNotification * monitoredItems
Definition: open62541.h:4507
#define UA_STATUSCODE_GOODDATAIGNORED
Definition: open62541.h:853
#define UA_STATUSCODE_BADENCODINGERROR
Definition: open62541.h:657
#define UA_TYPES_DELETEMONITOREDITEMSREQUEST
Definition: open62541.h:4363
UA_UInt16 typeIndex
Definition: open62541.h:1656
#define UA_TYPES_SETPUBLISHINGMODEREQUEST
Definition: open62541.h:3569
void UA_Subscription_publishCallback(UA_Server *server, UA_Subscription *sub)
#define UA_TYPES_MODIFYMONITOREDITEMSREQUEST
Definition: open62541.h:4536
#define UA_STATUSCODE_BADCERTIFICATEINVALID
Definition: open62541.h:672
UA_ByteString incompleteMessage
Definition: open62541.h:9488
#define UA_TYPES_DELETEREFERENCESITEM
Definition: open62541.h:3626
UA_Variant value
Definition: open62541.h:1574
#define APPLICATION_NAME
Definition: open62541.c:27556
void(* UA_Service)(UA_Server *, UA_Session *, const void *request, void *response)
Definition: open62541.c:4394
UA_StatusCode innerStatusCode
Definition: open62541.h:1600
UA_NodeStore * UA_NodeStore_new(void)
Nodestore Lifecycle ^^^^^^^^^^^^^^^^^^^.
Definition: open62541.c:19327
UA_String endpointUrl
Definition: open62541.c:2554
#define UA_TYPES_SIGNEDSOFTWARECERTIFICATE
Definition: open62541.h:3246
#define STARTTOKENID
Definition: open62541.c:18622
#define LIST_NEXT(elm, field)
Definition: open62541.c:217
UA_AddNodesItem * nodesToAdd
Definition: open62541.h:4991
UA_MonitoredItem * UA_MonitoredItem_new(void)
UA_Boolean UA_Guid_equal(const UA_Guid *g1, const UA_Guid *g2)
Definition: open62541.c:4904
AddReferencesItem ^^^^^^^^^^^^^^^^^ A request to add a reference to the server address space...
Definition: open62541.h:4614
UA_StatusCode UA_SecureChannelManager_close(UA_SecureChannelManager *cm, UA_UInt32 channelId)
Definition: open62541.c:18793
#define UA_TYPES_READVALUEID
Definition: open62541.h:3880
#define UA_TYPES_BROWSEPATH
Definition: open62541.h:5019
UA_UInt32 requestId
Definition: open62541.c:3224
UA_String username
Definition: open62541.c:4738
UA_Boolean containsNoLoops
Definition: open62541.c:3688
UA_ByteString serverCertificate
Definition: open62541.h:5071
void UA_Client_reset(UA_Client *client)
Definition: open62541.c:24698
#define UA_NS0ID_REFERENCETYPESFOLDER
Definition: open62541.h:1869
UA_DateTime publishTime
Definition: open62541.h:3375
UA_StatusCode statusCode
Definition: open62541.h:5026
UA_NODE_BASEATTRIBUTES UA_Boolean isAbstract
Definition: open62541.c:3652
RelativePath ^^^^^^^^^^^^ A relative path constructed from reference types and browse names...
Definition: open62541.h:4657
UA_TcpMessageHeader messageHeader
Definition: open62541.c:2664
TranslateBrowsePathsToNodeIdsRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Translates one or more path...
Definition: open62541.h:5125
UA_UInt32 size
Definition: open62541.c:19163
UA_QualifiedName browseName
Definition: open62541.h:4817
#define UA_STATUSCODE_BADCONDITIONALREADYDISABLED
Definition: open62541.h:824
struct UA_NodeStoreEntry * orig
Definition: open62541.c:19155
UA_DeleteNodesItem * nodesToDelete
Definition: open62541.h:3984
#define UA_STATUSCODE_BADDUPLICATEREFERENCENOTALLOWED
Definition: open62541.h:763
#define UA_STATUSCODE_UNCERTAINREFERENCENOTDELETED
Definition: open62541.h:767
UA_String UA_ByteString
ByteString ^^^^^^^^^^ A sequence of octets.
Definition: open62541.h:1122
#define UA_STATUSCODE_BADINDEXRANGEINVALID
Definition: open62541.h:709
UA_Byte data4[8]
Definition: open62541.h:1111
#define UA_NS0ID_QUALIFIEDNAME
Definition: open62541.h:1815
size_t namespacesSize
Definition: open62541.c:4213
UA_StatusCode UA_Client_manuallyRenewSecureChannel(UA_Client *client)
Definition: open62541.c:25314
UA_LogLevel
Logging
Definition: open62541.h:9630
UA_NodeId dataType
Definition: open62541.h:3713
UA_StatusCode Subscription_unregisterPublishJob(UA_Server *server, UA_Subscription *sub)
#define UA_STATUSCODE_BADCERTIFICATEUNTRUSTED
Definition: open62541.h:680
void(* UA_deleteMembersSignature)(void *p, const UA_DataType *type)
Definition: open62541.c:5681
CreateSessionRequest ^^^^^^^^^^^^^^^^^^^^ Creates a new session with the server.
Definition: open62541.h:5038
UA_String securityPolicyUri
Definition: open62541.h:4347
size_t resultsSize
Definition: open62541.h:4775
UA_UInt32 userWriteMask
Definition: open62541.h:3960
void UA_Server_deleteAllRepeatedJobs(UA_Server *server)
Definition: open62541.c:18256
#define UA_NS0ID_OBJECTSFOLDER
Definition: open62541.h:1863
#define MAXBACKLOG
For the multithreaded mode, assume a single thread that periodically "gets work" from the network lay...
Definition: open62541.c:26921
struct UA_ExtensionObject::@1::@3 decoded
#define UA_STATUSCODE_BADCONTINUATIONPOINTINVALID
Definition: open62541.h:734
QueryFirstRequest ^^^^^^^^^^^^^^^^^.
Definition: open62541.h:5172
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_SOFTWAREVERSION
Definition: open62541.h:2548
#define UA_NS0ID_BOOLEAN
Definition: open62541.h:1796
UA_StatusCode UA_Server_editNode(UA_Server *server, UA_Session *session, const UA_NodeId *nodeId, UA_EditNodeCallback callback, const void *data)
Definition: open62541.c:17885
#define UA_TYPES_GUID
Guid ^^^^.
Definition: open62541.h:3169
#define UA_STATUSCODE_BADCONDITIONDISABLED
Definition: open62541.h:826
FindServersRequest ^^^^^^^^^^^^^^^^^^ Finds the servers known to the discovery server.
Definition: open62541.h:4556
#define UA_NS0ID_TRANSLATEBROWSEPATHSTONODEIDSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2152
#define MAX_PICO_SECONDS
Definition: open62541.c:7024
UA_ResponseHeader responseHeader
Definition: open62541.h:4085
#define UA_STATUSCODE_BADOUTOFSERVICE
Definition: open62541.h:813
#define TAILQ_REMOVE(head, elm, field)
Definition: open62541.c:526
AddNodesItem ^^^^^^^^^^^^ A request to add a node to the server address space.
Definition: open62541.h:4813
#define UA_STATUSCODE_BADCONNECTIONREJECTED
Definition: open62541.h:867
SymmetricAlgorithmSecurityHeader ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Secure Layer Symmetric Algorithm He...
Definition: open62541.c:2653
#define UA_RCU_UNLOCK()
Definition: open62541.c:4178
UA_SecureChannel channel
Definition: open62541.c:4096
struct ServerNetworkLayerTCP::ConnectionMapping * mappings
UA_ExtensionObjectEncoding encoding
Definition: open62541.h:1548
UA_ByteString continuationPoint
Definition: open62541.h:5027
void UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection, const UA_ByteString *message)
Definition: open62541.c:17565
#define UA_NodeStore_newObjectTypeNode()
Definition: open62541.c:3993
#define CHECK_NODECLASS(CLASS)
Definition: open62541.c:20687
CreateMonitoredItemsRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4945
struct UA_Job::@5::@6 binaryMessage
#define TAILQ_FOREACH(var, head, field)
Definition: open62541.c:461
UA_StatusCode UA_Client_NamespaceGetIndex(UA_Client *client, UA_String *namespaceUri, UA_UInt16 *namespaceIndex)
Definition: open62541.c:25489
#define CHECK_DATATYPE_ARRAY(EXP_DT)
Definition: open62541.c:20998
ServiceFault ^^^^^^^^^^^^ The response returned by all services when there is a service level error...
Definition: open62541.h:4923
#define UA_NS0ID_CREATESESSIONREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2059
#define UA_TRANSPORT_TCPACKNOWLEDGEMESSAGE
Definition: open62541.c:2611
#define UA_STATUSCODE_BADDISCONNECT
Definition: open62541.h:868
#define UA_NS0ID_VARIABLETYPESFOLDER
Definition: open62541.h:1867
UA_StatusCode UA_SecureChannel_processChunks(UA_SecureChannel *channel, const UA_ByteString *chunks, UA_ProcessMessageCallback callback, void *application)
Definition: open62541.c:15497
#define UA_TYPES_WRITEREQUEST
Definition: open62541.h:4416
UA_CallMethodResult UA_EXPORT UA_Server_call(UA_Server *server, const UA_CallMethodRequest *request)
Method Call
#define UA_STATUSCODE_BADINTERNALERROR
Definition: open62541.h:653
UA_MonitoringMode
MonitoringMode ^^^^^^^^^^^^^^.
Definition: open62541.h:3429
CreateSubscriptionRequest ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4227
struct UA_MonitoredItem UA_MonitoredItem
UA_ChannelSecurityToken securityToken
Definition: open62541.h:4087
#define UA_TYPES_ACTIVATESESSIONREQUEST
Definition: open62541.h:4078
#define UA_INT32_MAX
Definition: open62541.h:964
#define UA_TYPES_GETENDPOINTSREQUEST
Definition: open62541.h:4473
bool UA_Boolean
Boolean ^^^^^^^ A two-state logical value (true or false).
Definition: open62541.h:922
#define UA_TYPES_DATAVALUE
DataValue ^^^^^^^^^.
Definition: open62541.h:3223
void UA_Client_delete(UA_Client *client)
Definition: open62541.c:24703
#define UA_NS0ID_BASEDATATYPE
Definition: open62541.h:1819
#define UA_STATUSCODE_UNCERTAINREFERENCEOUTOFSERVER
Definition: open62541.h:776
DiagnosticInfo ^^^^^^^^^^^^^^ A structure that contains detailed error and diagnostic information ass...
Definition: open62541.h:1587
#define UA_TYPES_INT16
Int16 ^^^^^.
Definition: open62541.h:3109
#define SIMPLEQ_ENTRY(type)
Definition: open62541.c:289
#define UA_TRANSPORT_TCPHELLOMESSAGE
Definition: open62541.c:2557
UA_DateTime UA_DateTime_now(void)
Definition: open62541.c:27443
DataTypeAttributes ^^^^^^^^^^^^^^^^^^ The attributes for a data type node.
Definition: open62541.h:3886
#define UA_INLINE
Inline Functions
Definition: open62541.h:152
TcpAcknowledgeMessage ^^^^^^^^^^^^^^^^^^^^^ Acknowledge Message.
Definition: open62541.c:2603
UA_StatusCode UA_SessionManager_createSession(UA_SessionManager *sm, UA_SecureChannel *channel, const UA_CreateSessionRequest *request, UA_Session **session)
Definition: open62541.c:18899
#define LEAPOCH
Definition: open62541.c:26280
UA_StatusCode UA_Server_addDataSourceVariableNode(UA_Server *server, const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId, const UA_QualifiedName browseName, const UA_NodeId typeDefinition, const UA_VariableAttributes attr, const UA_DataSource dataSource, UA_NodeId *outNewNodeId)
Definition: open62541.c:22065
UA_StatusCode UA_Client_connect(UA_Client *client, const char *endpointUrl)
Definition: open62541.c:25255
UA_StatusCode UA_Client_disconnect(UA_Client *client)
Definition: open62541.c:25300
const UA_ExpandedNodeId UA_EXPANDEDNODEID_NULL
Definition: open62541.c:4776
#define UA_TYPES_PUBLISHREQUEST
Definition: open62541.h:4485
struct MonitoredItem_queuedValue MonitoredItem_queuedValue
UA_ServerCallback method
Definition: open62541.h:9594
const UA_DataType * responseType
Definition: open62541.c:25330
UA_RelativePathElement * elements
Definition: open62541.h:4659
UA_UInt16 milliSec
Definition: open62541.h:1090
QueryNextRequest ^^^^^^^^^^^^^^^^.
Definition: open62541.h:4188
UA_StatusCode UA_Client_forEachChildNodeCall(UA_Client *client, UA_NodeId parentNodeId, UA_NodeIteratorCallback callback, void *handle)
Definition: open62541.c:25530
#define UA_STATUSCODE_BADNODEIDUNKNOWN
Definition: open62541.h:707
#define UA_TYPES_OPENSECURECHANNELREQUEST
Definition: open62541.h:4297
#define UA_NS0ID_SERVER_SERVERSTATUS_STATE
Definition: open62541.h:2543
#define UA_STATUSCODE_BADWOULDBLOCK
Definition: open62541.h:876
UA_StatusCode UA_NodeStore_insert(UA_NodeStore *ns, UA_Node *node)
Insert / Get / Replace / Remove ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.c:19370
#define UA_NS0ID_HASENCODING
Definition: open62541.h:1833
#define UA_NS0ID_NONHIERARCHICALREFERENCES
Definition: open62541.h:1827
SignatureData ^^^^^^^^^^^^^ A digital signature.
Definition: open62541.h:3688
#define UA_TYPES_CLOSESECURECHANNELRESPONSE
Definition: open62541.h:4522
DeleteSubscriptionsRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3917
#define UA_STATUSCODE_BADINDEXRANGENODATA
Definition: open62541.h:710
UA_Node * UA_NodeStore_getCopy(UA_NodeStore *ns, const UA_NodeId *nodeid)
Definition: open62541.c:19435
UA_Double revisedSessionTimeout
Definition: open62541.h:5155
#define UA_STATUSCODE_GOODENTRYREPLACED
Definition: open62541.h:845
size_t UA_readNumber(UA_Byte *buf, size_t buflen, UA_UInt32 *number)
Definition: open62541.c:15128
UA_ServerState state
Definition: open62541.h:4832
UA_UserTokenType tokenType
Definition: open62541.h:4344
UA_DataValue value
Definition: open62541.h:3636
#define UA_TYPES_WRITERESPONSE
Definition: open62541.h:4208
#define UA_STATUSCODE_BADMONITOREDITEMFILTERINVALID
Definition: open62541.h:722
double UA_Double
Double ^^^^^^ An IEEE double precision (64 bit) floating point value.
Definition: open62541.h:1001
MonitoredItemModifyResult ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3316
#define UA_LOG_INFO_SESSION(LOGGER, SESSION, MSG,...)
Definition: open62541.c:3787
#define SLIST_FOREACH_SAFE(var, head, field, tvar)
Definition: open62541.c:150
#define UA_NS0ID_INT64
Definition: open62541.h:1803
UA_MonitoredItemCreateResult * results
Definition: open62541.h:4685
UA_ResponseHeader responseHeader
Definition: open62541.h:5152
#define UA_STATUSCODE_BADSTATENOTACTIVE
Definition: open62541.h:795
#define UA_STATUSCODE_BADTARGETNODEIDINVALID
Definition: open62541.h:762
#define SLIST_REMOVE(head, elm, type, field)
Definition: open62541.c:180
void * handle
Definition: open62541.h:9487
#define UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE
Definition: open62541.h:4282
#define UA_STATUSCODE_BADDIALOGNOTACTIVE
Definition: open62541.h:829
UA_Boolean executable
Definition: open62541.h:3608
#define UA_NS0ID_HASMODELLINGRULE
Definition: open62541.h:1832
UA_StatusCode __UA_Server_read(UA_Server *server, const UA_NodeId *nodeId, const UA_AttributeId attributeId, void *v)
Definition: open62541.c:20940
#define UA_NS0ID_SERVER_AUDITING
Definition: open62541.h:2635
#define UA_STATUSCODE_BADBROWSENAMEDUPLICATED
Definition: open62541.h:758
#define UA_TYPES_SUBSCRIPTIONACKNOWLEDGEMENT
Definition: open62541.h:3867
ReferenceDescription ^^^^^^^^^^^^^^^^^^^^ The description of a reference.
Definition: open62541.h:4571
UA_UInt16 sourcePicoseconds
Definition: open62541.h:1577
#define UA_TYPES_USERIDENTITYTOKEN
Definition: open62541.h:3730
#define UA_STATUSCODE_BADINVALIDSELFREFERENCE
Definition: open62541.h:764
#define UA_STATUSCODE_GOODMOREDATA
Definition: open62541.h:848
#define SLIST_ENTRY(type)
Definition: open62541.c:132
UA_ResponseHeader responseHeader
Definition: open62541.h:5087
UA_DateTime timestamp
Definition: open62541.h:3302
UA_String transportProfileUri
Definition: open62541.h:5076
#define UA_STATUSCODE_BADTOOMANYMATCHES
Definition: open62541.h:777
UA_Client_Authentication
Definition: open62541.c:4717
#define UA_NS0ID_SERVER_SERVERREDUNDANCY
Definition: open62541.h:2573
void Service_UnregisterNodes(UA_Server *server, UA_Session *session, const UA_UnregisterNodesRequest *request, UA_UnregisterNodesResponse *response)
Definition: open62541.c:23277
UA_Int32 symbolicId
Definition: open62541.h:1595
#define UA_TYPES_INT32
Int32 ^^^^^.
Definition: open62541.h:3121
#define UA_NodeStore_newReferenceTypeNode()
Definition: open62541.c:3997
#define UA_STATUSCODE_BADRESPONSETOOLARGE
Definition: open62541.h:661
#define UA_NS0ID_ADDREFERENCESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2092
#define UA_STATUSCODE_BADUSERSIGNATUREINVALID
Definition: open62541.h:747
const UA_ObjectTypeNode * getObjectNodeType(UA_Server *server, const UA_ObjectNode *node)
Definition: open62541.c:17860
BrowseNextRequest ^^^^^^^^^^^^^^^^^ Continues one or more browse operations.
Definition: open62541.h:4214
UA_ResponseHeader responseHeader
Definition: open62541.h:4304
size_t UA_calcSizeBinary(void *p, const UA_DataType *type)
Definition: open62541.c:7554
#define UA_STATUSCODE_BADREFERENCETYPEIDINVALID
Definition: open62541.h:736
UA_Guid UA_Guid_random(void)
Definition: open62541.c:4911
#define UA_NS0ID_INTEGER
Definition: open62541.h:1822
UA_StatusCode MonitoredItem_registerSampleJob(UA_Server *server, UA_MonitoredItem *mon)
#define UA_STATUSCODE_BADCERTIFICATEISSUERREVOKED
Definition: open62541.h:684
#define UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID
Definition: open62541.h:695
#define SIMPLEQ_FIRST(head)
Definition: open62541.c:297
const UA_encodeBinarySignature encodeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT+1]
Definition: open62541.c:7168
UA_StatusCode getTypeHierarchy(UA_NodeStore *ns, const UA_Node *rootRef, UA_Boolean inverse, UA_NodeId **typeHierarchy, size_t *typeHierarchySize)
Definition: open62541.c:17718
#define UA_TYPES_COUNT
Every type is assigned an index in an array containing the type descriptions.
Definition: open62541.h:3084
UA_Session * UA_SecureChannel_getSession(UA_SecureChannel *channel, UA_NodeId *token)
Definition: open62541.c:15238
UA_SecureChannel channel
Definition: open62541.c:4732
UA_ResponseHeader responseHeader
Definition: open62541.h:4201
#define UA_OPEN62541_VER_MAJOR
Library Version
Definition: open62541.h:39
#define CLOSESOCKET(S)
Definition: open62541.c:26695
#define UA_NS0ID_HASPROPERTY
Definition: open62541.h:1839
DeleteReferencesRequest ^^^^^^^^^^^^^^^^^^^^^^^ Delete one or more references from the server address...
Definition: open62541.h:4747
#define UA_NS0ID_INT16
Definition: open62541.h:1799
Argument ^^^^^^^^ An argument for a method.
Definition: open62541.h:3711
#define UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_LOCALE
Definition: open62541.c:6623
size_t subscriptionAcknowledgementsSize
Definition: open62541.h:4481
#define UA_NS0ID_HASDESCRIPTION
Definition: open62541.h:1834
UA_UInt16 memberTypeIndex
Definition: open62541.h:1635
UserNameIdentityToken ^^^^^^^^^^^^^^^^^^^^^ A token representing a user identified by a user name and...
Definition: open62541.h:4023
UA_UInt32 * arrayDimensions
Definition: open62541.h:1405
UA_StatusCode writeDataTypeAttribute(UA_Server *server, UA_VariableNode *node, const UA_NodeId *dataType, const UA_NodeId *constraintDataType)
Definition: open62541.c:20397
UA_Byte userAccessLevel
Definition: open62541.c:3464
#define UA_TYPES_CLOSESESSIONRESPONSE
Definition: open62541.h:4900
#define UA_NS0ID_MODIFYSUBSCRIPTIONREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2391
void Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel, UA_Session *session, const UA_ActivateSessionRequest *request, UA_ActivateSessionResponse *response)
Definition: open62541.c:19934
UA_Boolean overlayable
Definition: open62541.h:1662
UA_ExtensionObject additionalHeader
Definition: open62541.h:3908
#define UA_STATUSCODE_BADNOCONTINUATIONPOINTS
Definition: open62541.h:735
UA_StatusCode UA_SessionManager_removeSession(UA_SessionManager *sm, const UA_NodeId *token)
Definition: open62541.c:18926
#define UA_NS0ID_HASORDEREDCOMPONENT
Definition: open62541.h:1842
#define UA_TYPES_DATACHANGEFILTER
Definition: open62541.h:4878
#define UA_STATUSCODE_BADTYPEMISMATCH
Definition: open62541.h:786
UA_Double timeout
Definition: open62541.c:3733
UA_RequestHeader requestHeader
Definition: open62541.h:4316
UA_BrowseDirection browseDirection
Definition: open62541.h:4439
UA_NodeId referenceTypeId
Definition: open62541.h:3700
#define UA_STATUSCODE_BADTCPINTERNALERROR
Definition: open62541.h:801
#define UA_STATUSCODE_BADTCPMESSAGETOOLARGE
Definition: open62541.h:799
void * UA_Array_new(size_t size, const UA_DataType *type)
Definition: open62541.c:5753
CallMethodResult ^^^^^^^^^^^^^^^^.
Definition: open62541.h:3443
#define UA_TYPES_UINT32
UInt32 ^^^^^^.
Definition: open62541.h:3127
UA_UInt16 UA_Server_addNamespace(UA_Server *server, const char *name)
Definition: open62541.c:15770
UA_StatusCode compatibleArrayDimensions(size_t constraintArrayDimensionsSize, const UA_UInt32 *constraintArrayDimensions, size_t testArrayDimensionsSize, const UA_UInt32 *testArrayDimensions)
Definition: open62541.c:20118
AsymmetricAlgorithmSecurityHeader ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Security Header.
Definition: open62541.c:2591
TcpErrorMessage ^^^^^^^^^^^^^^^ Error Message.
Definition: open62541.c:2563
UA_Boolean processed
Definition: open62541.c:25327
#define UA_STATUSCODE_BADNOTIMPLEMENTED
Definition: open62541.h:719
UA_NODE_BASEATTRIBUTES UA_NODE_VARIABLEATTRIBUTES UA_Byte accessLevel
Definition: open62541.c:3463
UA_ExtensionObjectEncoding
Definition: open62541.h:1537
size_t nodesToWriteSize
Definition: open62541.h:4412
UA_VARIANT_ENCODINGMASKTYPE
Definition: open62541.c:6843
#define UA_TYPES_BYTESTRING
ByteString ^^^^^^^^^^.
Definition: open62541.h:3175
UA_UInt32 u32
Definition: open62541.c:777
SignedSoftwareCertificate ^^^^^^^^^^^^^^^^^^^^^^^^^ A software certificate with a digital signature...
Definition: open62541.h:3241
#define UA_STATUSCODE_BADVIEWIDUNKNOWN
Definition: open62541.h:769
#define UA_STATUSCODE_BADNODEATTRIBUTESINVALID
Definition: open62541.h:759
#define UA_TYPES_UINT64
UInt64 ^^^^^^.
Definition: open62541.h:3139
UA_LocalizedText displayName
Definition: open62541.h:3352
#define UA_UINT16_MAX
Definition: open62541.h:956
#define UA_STATUSCODE_BADDATALOST
Definition: open62541.h:839
#define UA_STATUSCODE_BADDEPENDENTVALUECHANGED
Definition: open62541.h:861
#define UA_NS0ID_SERVER_SERVERSTATUS_SECONDSTILLSHUTDOWN
Definition: open62541.h:2633
UA_Boolean UA_Node_hasSubTypeOrInstances(const UA_Node *node)
Definition: open62541.c:17868
UA_String * namespaces
Definition: open62541.c:4214
UA_DataValue * results
Definition: open62541.h:4776
UA_UInt32 requestId
Definition: open62541.c:2619
#define UA_STATUSCODE_BADREQUESTCANCELLEDBYCLIENT
Definition: open62541.h:698
#define UA_STATUSCODE_BADCERTIFICATEHOSTNAMEINVALID
Definition: open62541.h:676
#define UA_STATUSCODE_GOODCALLAGAIN
Definition: open62541.h:864
UA_UInt32 maxRequestMessageSize
Definition: open62541.c:3731
ReadValueId ^^^^^^^^^^^.
Definition: open62541.h:3873
UA_String UA_String_fromChars(char const src[])
Definition: open62541.c:4813
#define CHECK_NODECLASS_WRITE(CLASS)
Definition: open62541.c:21006
#define UA_NS0ID_INT32
Definition: open62541.h:1801
const UA_DataType * UA_findDataType(const UA_NodeId *typeId)
Builtin data types can be accessed as UA_TYPES[UA_TYPES_XXX], where XXX is the name of the data type...
Definition: open62541.c:4781
UA_String additionalInfo
Definition: open62541.h:1599
UA_Int64 i64
Definition: open62541.c:780
#define UA_STATUSCODE_BADDATAENCODINGINVALID
Definition: open62541.h:711
UA_StatusCode UA_SecureChannel_generateNonce(UA_ByteString *nonce)
Definition: open62541.c:15193
UA_String indexRange
Definition: open62541.h:3635
const UA_NodeId UA_NODEID_NULL
Definition: open62541.c:4775
UA_ExtensionObject filter
Definition: open62541.h:3677
#define UA_STATUSCODE_BADCERTIFICATECHAININCOMPLETE
Definition: open62541.h:685
#define UA_STATUSCODE_BADSESSIONIDINVALID
Definition: open62541.h:692
#define DOUBLE_INF
Definition: open62541.c:6199
UA_Connection connection
Definition: open62541.c:4728
uint16_t UA_UInt16
UInt16 ^^^^^^ An integer value between 0 and 65 535.
Definition: open62541.h:954
#define UA_STATUSCODE_BADBROWSENAMEINVALID
Definition: open62541.h:757
#define UA_STATUSCODE_GOODNODATA
Definition: open62541.h:847
#define UA_NS0ID_UINTEGER
Definition: open62541.h:1823
#define UA_NS0ID_HASCAUSE
Definition: open62541.h:1845
UA_LocalizedText inverseName
Definition: open62541.h:4377
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXBROWSECONTINUATIONPOINTS
Definition: open62541.h:2611
#define UA_NS0ID_BASEDATAVARIABLETYPE
Definition: open62541.h:1851
UA_ExtensionObject nodeAttributes
Definition: open62541.h:4819
UA_Boolean hasLocalizedText
Definition: open62541.h:1590
UA_UInt16 data3
Definition: open62541.h:1110
OpenSecureChannelResponse ^^^^^^^^^^^^^^^^^^^^^^^^^ Creates a secure channel with a server...
Definition: open62541.h:4084
void Service_Read_single(UA_Server *server, UA_Session *session, UA_TimestampsToReturn timestamps, const UA_ReadValueId *id, UA_DataValue *v)
Definition: open62541.c:20693
UA_ClientState UA_Client_getState(UA_Client *client)
Definition: open62541.c:24708
UA_Boolean fixedSize
Definition: open62541.h:1660
UA_StatusCode UA_Server_delayedFree(UA_Server *server, void *data)
Definition: open62541.c:18273
#define UA_STATUSCODE_BADTIMESTAMPNOTSUPPORTED
Definition: open62541.h:843
UA_Boolean hasSourcePicoseconds
Definition: open62541.h:1572
struct UA_DiagnosticInfo * innerDiagnosticInfo
Definition: open62541.h:1601
AddNodesRequest ^^^^^^^^^^^^^^^ Adds one or more nodes to the server address space.
Definition: open62541.h:4988
#define UA_LOG_DEBUG_SESSION(LOGGER, SESSION, MSG,...)
Definition: open62541.c:3780
#define UA_TYPES_CREATESUBSCRIPTIONREQUEST
Definition: open62541.h:4237
#define UA_NS0ID_VIEWSFOLDER
Definition: open62541.h:1865
#define UA_TYPES_CALLMETHODRESULT
Definition: open62541.h:3453
UA_AsymmetricAlgorithmSecurityHeader clientAsymAlgSettings
Definition: open62541.c:3236
#define UA_TYPES_PUBLISHRESPONSE
Definition: open62541.h:4006
UA_QualifiedName browseName
Definition: open62541.h:4575
RequestHeader ^^^^^^^^^^^^^ The header passed with every server request.
Definition: open62541.h:3300
UA_SecurityTokenRequestType requestType
Definition: open62541.h:4291
#define ADDPROFILEARRAY(x)
UA_StatusCode UA_Subscription_deleteMonitoredItem(UA_Server *server, UA_Subscription *sub, UA_UInt32 monitoredItemID)
UA_UInt32 protocolVersion
Definition: open62541.c:2549
Definition: open62541.c:3215
#define UA_TYPES_RELATIVEPATH
Definition: open62541.h:4662
UA_StatusCode UA_SecureChannelManager_open(UA_SecureChannelManager *cm, UA_Connection *conn, const UA_OpenSecureChannelRequest *request, UA_OpenSecureChannelResponse *response)
Definition: open62541.c:18702
#define UA_NS0ID_GENERATESEVENT
Definition: open62541.h:1836
#define UA_NS0ID_GETENDPOINTSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2026
UA_UInt32 maxMessageSize
Definition: open62541.h:9453
#define UA_TYPES_BROWSERESPONSE
Definition: open62541.h:5145
#define UA_TYPES_FINDSERVERSRESPONSE
Definition: open62541.h:4939
#define UA_STATUSCODE_BADTIMEOUT
Definition: open62541.h:663
UA_UInt16 namespaceIndex
Definition: open62541.h:1288
#define FNV_PRIME_32
Definition: open62541.c:5031
#define UA_TYPES_MODIFYSUBSCRIPTIONREQUEST
Definition: open62541.h:4336
AddNodesResponse ^^^^^^^^^^^^^^^^ Adds one or more nodes to the server address space.
Definition: open62541.h:4491
#define UA_STATUSCODE_BADNOVALIDCERTIFICATES
Definition: open62541.h:749
#define UA_TYPES_SBYTE
SByte ^^^^^.
Definition: open62541.h:3097
#define errno__
Definition: open62541.c:26742
struct channel_list_entry channel_list_entry
#define UA_TYPES_ADDNODESITEM
Definition: open62541.h:4823
void Service_DeleteMonitoredItems(UA_Server *server, UA_Session *session, const UA_DeleteMonitoredItemsRequest *request, UA_DeleteMonitoredItemsResponse *response)
SetPublishingModeRequest ^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3562
const UA_Guid UA_GUID_NULL
Definition: open62541.c:4774
#define UA_STATUSCODE_BADMONITOREDITEMFILTERUNSUPPORTED
Definition: open62541.h:723
UA_StatusCode * results
Definition: open62541.h:4713
#define UA_TYPES_DELETENODESRESPONSE
Definition: open62541.h:4718
UA_BrowseResult UA_Server_browse(UA_Server *server, UA_UInt32 maxrefs, const UA_BrowseDescription *descr)
Browsing
Definition: open62541.c:22879
UA_Double requestedPublishingInterval
Definition: open62541.h:4229
#define TAILQ_LAST(head, headname)
Definition: open62541.c:453
UA_StatusCode readValueAttribute(UA_Server *server, const UA_VariableNode *vn, UA_DataValue *v)
Definition: open62541.c:20509
#define UA_STATUSCODE_BADREQUESTCANCELLEDBYREQUEST
Definition: open62541.h:751
void UA_NodeStore_deleteNode(UA_Node *node)
Definition: open62541.c:19363
#define UA_NS0ID_SERVERCAPABILITIESTYPE
Definition: open62541.h:2489
const UA_DataType * type
Definition: open62541.h:1400
RegisterNodesResponse ^^^^^^^^^^^^^^^^^^^^^ Registers one or more nodes for repeated use within a ses...
Definition: open62541.h:4303
UA_ResponseHeader responseHeader
Definition: open62541.h:3994
int64_t UA_DateTime
Definition: open62541.h:1070
UA_Int32 sockfd
Definition: open62541.h:9484
UA_MonitoredItemModifyResult * results
Definition: open62541.h:4762
DeleteMonitoredItemsResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3941
UA_StatusCode writeValueAttribute(UA_Server *server, UA_VariableNode *node, const UA_DataValue *value, const UA_String *indexRange)
Definition: open62541.c:20558
#define UA_TYPES_CONTENTFILTER
Definition: open62541.h:4964
#define UA_TRANSPORT_MESSAGETYPE
Definition: open62541.c:2585
UA_UInt32 secondsTillShutdown
Definition: open62541.h:4834
#define UA_NS0ID_PUBLISHREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2418
#define UA_TYPES_ARGUMENT
Definition: open62541.h:3720
#define TAILQ_INSERT_HEAD(head, elm, field)
Definition: open62541.c:492
UA_Int16 i16
Definition: open62541.c:776
UA_Node node
Definition: open62541.c:19156
void UA_Array_delete(void *p, size_t size, const UA_DataType *type)
Definition: open62541.c:5799
#define UA_STATUSCODE_BADNOTCONNECTED
Definition: open62541.h:810
#define UA_TYPES_ADDREFERENCESITEM
Definition: open62541.h:4623
#define UA_STATUSCODE_BADSERVERHALTED
Definition: open62541.h:667
ContentFilterResult ^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4601
UA_Client * client
Definition: open62541.c:25326
UA_SByte i8
Definition: open62541.c:774
ReferenceNode ^^^^^^^^^^^^^ Specifies a reference which belongs to a node.
Definition: open62541.h:3699
#define UA_TYPES_MESSAGESECURITYMODE
Definition: open62541.h:3668
UA_DataChangeTrigger trigger
Definition: open62541.h:4873
UA_EndpointDescription * endpoints
Definition: open62541.h:5089
UA_String sessionName
Definition: open62541.c:3728
UA_ByteString clientNonce
Definition: open62541.c:3238
UA_AddReferencesItem * referencesToAdd
Definition: open62541.h:4790
#define UA_STATUSCODE_BADREQUESTTIMEOUT
Definition: open62541.h:804
UA_UInt16 memSize
Definition: open62541.h:1655
UA_Boolean includeSubtypes
Definition: open62541.h:3476
#define UA_NS0ID_HASCOMPONENT
Definition: open62541.h:1840
Definition: open62541.c:4053
#define UA_STATUSCODE_BADOUTOFRANGE
Definition: open62541.h:715
#define UA_STATUSCODE_BADQUERYTOOCOMPLEX
Definition: open62541.h:778
size_t length
Definition: open62541.h:1039
UA_UInt32 retransmitSequenceNumber
Definition: open62541.h:4455
UA_ExpandedNodeId typeDefinition
Definition: open62541.h:4820
#define UA_STATUSCODE_BADHISTORYOPERATIONINVALID
Definition: open62541.h:782
UA_StatusCode Subscription_registerPublishJob(UA_Server *server, UA_Subscription *sub)
ReadRequest ^^^^^^^^^^^.
Definition: open62541.h:4799
UA_MonitoringParameters requestedParameters
Definition: open62541.h:4738
GetEndpointsResponse ^^^^^^^^^^^^^^^^^^^^ Gets the endpoints used by the server.
Definition: open62541.h:5086
#define UA_STATUSCODE_BADREFRESHINPROGRESS
Definition: open62541.h:823
UA_UInt16 data2
Definition: open62541.h:1109
UA_ApplicationDescription * servers
Definition: open62541.h:4936
#define UA_TYPES_ADDNODESREQUEST
Definition: open62541.h:4994
UA_ChannelSecurityToken securityToken
Definition: open62541.c:3234
#define UA_TYPES_CREATESESSIONRESPONSE
Definition: open62541.h:5166
CallResponse ^^^^^^^^^^^^.
Definition: open62541.h:4696
uint64_t UA_UInt64
UInt64 ^^^^^^ An integer value between 0 and 18 446 744 073 709 551 615.
Definition: open62541.h:987
#define UA_TYPES_DELETEREFERENCESRESPONSE
Definition: open62541.h:4676
#define UA_STATUSCODE_BADFILTERELEMENTINVALID
Definition: open62541.h:732
#define UA_NODEIDTYPE_NUMERIC_TWOBYTE
Definition: open62541.c:6445
#define TAILQ_ENTRY(type)
Definition: open62541.c:441
UA_StatusCode UA_Server_setVariableNode_dataSource(UA_Server *server, const UA_NodeId nodeId, const UA_DataSource dataSource)
Definition: open62541.c:22544
#define UA_STATUSCODE_BADDIALOGRESPONSEINVALID
Definition: open62541.h:830
#define DAYS_PER_400Y
Definition: open62541.c:26282
UA_StatusCode(* UA_exchangeEncodeBuffer)(void *handle, UA_ByteString *buf, size_t offset)
Definition: open62541.c:853
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_PRODUCTURI
Definition: open62541.h:2546
SecureConversationMessageAbortBody ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Secure Conversation Message Abo...
Definition: open62541.c:2525
SetMonitoringModeRequest ^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4386
void() UA_ProcessMessageCallback(void *application, UA_SecureChannel *channel, UA_MessageType messageType, UA_UInt32 requestId, const UA_ByteString *message)
Chunking
Definition: open62541.c:3265
#define DOUBLE_NEG_ZERO
Definition: open62541.c:6201
#define UA_STATUSCODE_BADMONITOREDITEMIDINVALID
Definition: open62541.h:721
#define UA_STATUSCODE_BADAGGREGATECONFIGURATIONREJECTED
Definition: open62541.h:852
UA_Boolean activated
Definition: open62541.c:3727
#define UA_TYPES_FLOAT
Float ^^^^^.
Definition: open62541.h:3145
#define UA_STATUSCODE_BADTOOMANYSESSIONS
Definition: open62541.h:746
#define UA_STATUSCODE_BADIDENTITYCHANGENOTSUPPORTED
Definition: open62541.h:750
#define UA_INT64_MAX
Definition: open62541.h:981
UA_Boolean containsNoLoops
Definition: open62541.h:3269
void Service_OpenSecureChannel(UA_Server *server, UA_Connection *connection, const UA_OpenSecureChannelRequest *request, UA_OpenSecureChannelResponse *response)
SecureChannel Service Set This Service Set defines Services used to open a communication channel that...
Definition: open62541.c:19841
#define UA_TYPES_REPUBLISHRESPONSE
Definition: open62541.h:4729
UA_StatusCode * results
Definition: open62541.h:4203
#define UA_free(_p_ptr)
UA_Boolean deleteBidirectional
Definition: open62541.h:3623
UA_DateTime timestamp
Definition: open62541.h:3902
UA_DateTime sourceTimestamp
Definition: open62541.h:1576
size_t(* getJobs)(UA_ServerNetworkLayer *nl, UA_Job **jobs, UA_UInt16 timeout)
Definition: open62541.h:9786
UA_DateTime nextChannelRenewal
Definition: open62541.c:4734
#define UA_TYPES_MONITOREDITEMMODIFYREQUEST
Definition: open62541.h:4017
UA_NodeId authenticationToken
Definition: open62541.h:5154
#define UA_LOG_INFO_CHANNEL(LOGGER, CHANNEL, MSG,...)
Definition: open62541.c:3286
#define UA_NS0ID_SERVER_GETMONITOREDITEMS_OUTPUTARGUMENTS
Definition: open62541.h:2771
void UA_Session_deleteMembersCleanup(UA_Session *session, UA_Server *server)
Definition: open62541.c:15637
#define UA_STATUSCODE_GOODNONCRITICALTIMEOUT
Definition: open62541.h:865
DeleteNodesRequest ^^^^^^^^^^^^^^^^^^ Delete one or more nodes from the server address space...
Definition: open62541.h:3981
#define UA_TYPES_READRESPONSE
Definition: open62541.h:4781
#define UA_STATUSCODE_BADNOTSUPPORTED
Definition: open62541.h:716
ContentFilter ^^^^^^^^^^^^^.
Definition: open62541.h:4959
UA_Variant * inputArguments
Definition: open62541.h:3504
UA_Server * UA_Server_new(const UA_ServerConfig config)
Definition: open62541.c:16125
#define UA_LOG_WARNING_SESSION(LOGGER, SESSION, MSG,...)
Definition: open62541.c:3794
SetPublishingModeResponse ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4587
status(* UA_decodeBinarySignature)(void *UA_RESTRICT dst, const UA_DataType *type)
Definition: open62541.c:5858
UA_String reason
Definition: open62541.c:2565
UA_MessageSecurityMode securityMode
Definition: open62541.h:5072
#define UA_NODESTORE_TOMBSTONE
Definition: open62541.c:19159
#define UA_STATUSCODE_BADNODEIDEXISTS
Definition: open62541.h:755
#define UA_TYPES_MONITOREDITEMCREATEREQUEST
Definition: open62541.h:4741
#define UA_STATUSCODE_UNCERTAINSENSORNOTACCURATE
Definition: open62541.h:819
const UA_decodeBinarySignature decodeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT+1]
Definition: open62541.c:7254
#define UA_NS0ID_WRITEREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2271
#define UA_NS0ID_SERVER
Definition: open62541.h:2537
UA_EndpointDescription * endpointDescriptions
Definition: open62541.c:4204
UA_MonitoringParameters requestedParameters
Definition: open62541.h:4014
UA_ResponseHeader responseHeader
Definition: open62541.h:4644
#define UA_STATUSCODE_BADINVALIDTIMESTAMPARGUMENT
Definition: open62541.h:784
BuildInfo ^^^^^^^^^.
Definition: open62541.h:3792
#define UA_NS0ID_FLOAT
Definition: open62541.h:1805
UA_UInt32 resultMask
Definition: open62541.h:4443
UA_StatusCode UA_Client_writeArrayDimensionsAttribute(UA_Client *client, const UA_NodeId nodeId, const UA_UInt32 *newArrayDimensions, size_t newArrayDimensionsSize)
Definition: open62541.c:25789
UA_ResponseHeader responseHeader
Definition: open62541.h:4145
QueryDataSet ^^^^^^^^^^^^.
Definition: open62541.h:3539
#define UA_TYPES_READREQUEST
Definition: open62541.h:4807
#define USERNAME_POLICY
Definition: open62541.c:4147
void UA_NodeStore_iterate(UA_NodeStore *ns, UA_NodeStore_nodeVisitor visitor)
Definition: open62541.c:19466
const UA_EXPORT UA_ClientConfig UA_ClientConfig_standard
Definition: open62541.c:27631
#define UA_STATUSCODE_BADAGGREGATELISTMISMATCH
Definition: open62541.h:849
#define UA_STATUSCODE_BADOPERATIONABANDONED
Definition: open62541.h:874
void UA_SecureChannel_init(UA_SecureChannel *channel)
Definition: open62541.c:15154
#define UA_TYPES_USERNAMEIDENTITYTOKEN
Definition: open62541.h:4030
UA_StatusCode __UA_Server_write(UA_Server *server, const UA_NodeId *nodeId, const UA_AttributeId attributeId, const UA_DataType *attr_type, const void *attr)
Definition: open62541.c:21170
#define SLIST_INSERT_HEAD(head, elm, field)
Definition: open62541.c:167
UA_ObjectLifecycleManagement lifecycleManagement
Definition: open62541.c:3545
#define UA_TYPES_BROWSEREQUEST
Definition: open62541.h:5008
#define UA_STATUSCODE_BADREFERENCELOCALONLY
Definition: open62541.h:765
#define UA_STATUSCODE_BADENCODINGLIMITSEXCEEDED
Definition: open62541.h:659
UA_Boolean final
Definition: open62541.c:3228
#define UA_EXPANDEDNODEID_SERVERINDEX_FLAG
Definition: open62541.c:6449
void Service_Call(UA_Server *server, UA_Session *session, const UA_CallRequest *request, UA_CallResponse *response)
void UA_SessionManager_cleanupTimedOut(UA_SessionManager *sm, UA_DateTime nowMonotonic)
Definition: open62541.c:18858
UA_UInt32 requestedMaxReferencesPerNode
Definition: open62541.h:5003
ReferenceTypeAttributes ^^^^^^^^^^^^^^^^^^^^^^^ The attributes for a reference type node...
Definition: open62541.h:4369
#define UA_STATUSCODE_BADTOOMANYOPERATIONS
Definition: open62541.h:669
DeleteNodesResponse ^^^^^^^^^^^^^^^^^^^ Delete one or more nodes from the server address space...
Definition: open62541.h:4710
#define UA_STATUSCODE_GOODDEPENDENTVALUECHANGED
Definition: open62541.h:858
UA_NodeClass targetNodeClass
Definition: open62541.h:4620
UA_ExpandedNodeId typeDefinition
Definition: open62541.h:4578
#define TAILQ_INIT(head)
Definition: open62541.c:487
#define UA_NS0ID_SERVER_SERVERREDUNDANCY_REDUNDANCYSUPPORT
Definition: open62541.h:2662
UA_Connection * connection
Definition: open62541.c:3242
UA_ResponseHeader responseHeader
Definition: open62541.h:5112
#define UA_NS0ID_SBYTE
Definition: open62541.h:1797
TranslateBrowsePathsToNodeIdsResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Translates one or more pa...
Definition: open62541.h:4858
#define UA_LOG_DEBUG_CHANNEL(LOGGER, CHANNEL, MSG,...)
Definition: open62541.c:3281
UA_UInt16 nanoSec
Definition: open62541.h:1088
UA_Connection UA_ClientConnectionTCP(UA_ConnectionConfig conf, const char *endpointUrl, UA_Logger logger)
Definition: open62541.c:27308
UA_Node * UA_NodeStore_newNode(UA_NodeClass nodeClass)
Node Lifecycle ^^^^^^^^^^^^^^.
Definition: open62541.c:19355
#define UA_NS0ID_DATATYPESFOLDER
Definition: open62541.h:1868
UA_String password
Definition: open62541.c:4739
UA_Boolean isNodeInTree(UA_NodeStore *ns, const UA_NodeId *leafNode, const UA_NodeId *nodeToFind, const UA_NodeId *referenceTypeIds, size_t referenceTypeIdsSize)
Definition: open62541.c:17792
#define UA_STATUSCODE_BADMESSAGENOTAVAILABLE
Definition: open62541.h:793
#define APPLICATION_URI
Definition: open62541.c:27557
#define UA_TYPES_ADDNODESRESPONSE
Definition: open62541.h:4499
void Service_Publish(UA_Server *server, UA_Session *session, const UA_PublishRequest *request, UA_UInt32 requestId)
UA_StatusCode UA_Variant_setRangeCopy(UA_Variant *v, const void *array, size_t arraySize, const UA_NumericRange range)
Definition: open62541.c:5491
#define UA_TYPES_PARSINGRESULT
Definition: open62541.h:3467
#define UA_PRINTF_GUID_DATA(GUID)
Definition: open62541.h:9727
#define INTERRUPTED
Definition: open62541.c:26743
#define UA_NS0ID_STRING
Definition: open62541.h:1807
#define UA_NS0ID_UINT64
Definition: open62541.h:1804
UA_UInt32 messageType
Definition: open62541.c:3225
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MINSUPPORTEDSAMPLERATE
Definition: open62541.h:2555
void UA_SecureChannelManager_deleteMembers(UA_SecureChannelManager *cm)
Definition: open62541.c:18634
#define UA_ASSERT_RCU_UNLOCKED()
Definition: open62541.c:4180
#define UA_SEC_TO_DATETIME
Definition: open62541.h:1075
void(* UA_ServerCallback)(UA_Server *server, void *data)
Definition: open62541.h:9574
UA_UInt32 maxResponseMessageSize
Definition: open62541.h:5047
UA_UInt16 nThreads
Definition: open62541.h:9822
UA_StatusCode UA_Server_run_startup(UA_Server *server)
Definition: open62541.c:18439
UA_UInt16 u16
Definition: open62541.c:775
ViewDescription ^^^^^^^^^^^^^^^ The view to browse.
Definition: open62541.h:3929
#define UA_NS0ID_REFERENCES
Definition: open62541.h:1826
#define UA_NS0ID_DELETENODESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2098
#define UA_STATUSCODE_BADREQUESTINTERRUPTED
Definition: open62541.h:803
void(* UA_NodeStore_nodeVisitor)(const UA_Node *node)
Iteration ^^^^^^^^^ The following definitions are used to call a callback for every node in the nodes...
Definition: open62541.c:4037
#define UA_TYPES_STRING
String ^^^^^^.
Definition: open62541.h:3157
uint32_t pcg32_random_r(pcg32_random_t *rng)
Definition: open62541.c:26392
RepublishResponse ^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4724
#define UA_NS0ID_LOCALIZEDTEXT
Definition: open62541.h:1816
UA_NodeId nodeId
Definition: open62541.h:3852
CreateSubscriptionResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4629
BrowseResponse ^^^^^^^^^^^^^^ Browse the references for one or more nodes from the server address spa...
Definition: open62541.h:5137
UA_UInt32 requestHandle
Definition: open62541.c:4744
float UA_Float
Float ^^^^^ An IEEE single precision (32 bit) floating point value.
Definition: open62541.h:995
#define UA_NS0ID_HASMODELPARENT
Definition: open62541.h:3066
UA_Boolean hasServerTimestamp
Definition: open62541.h:1571
Definition: open62541.c:4095
UA_UInt16 hour
Definition: open62541.h:1093
UA_NodeStoreEntry ** entries
Definition: open62541.c:19162
UA_UInt32 requestId
Definition: open62541.c:4733
UA_DateTime startTime
Definition: open62541.c:4202
UA_UInt32 sequenceNumber
Definition: open62541.h:3374
#define UA_STATUSCODE_BADNOTFOUND
Definition: open62541.h:717
UA_ResponseHeader responseHeader
Definition: open62541.h:4492
UA_LocalizedText description
Definition: open62541.h:3353
UA_Boolean hasValue
Definition: open62541.h:1568
UA_SecureChannel * UA_SecureChannelManager_get(UA_SecureChannelManager *cm, UA_UInt32 channelId)
Definition: open62541.c:18783
#define UA_STATUSCODE_BADSERVERNAMEMISSING
Definition: open62541.h:740
#define UA_STATUSCODE_BADDATAUNAVAILABLE
Definition: open62541.h:840
UA_UInt32 sendBufferSize
Definition: open62541.c:2551
void Service_Browse(UA_Server *server, UA_Session *session, const UA_BrowseRequest *request, UA_BrowseResponse *response)
Definition: open62541.c:22850
UA_Session * UA_SessionManager_getSession(UA_SessionManager *sm, const UA_NodeId *token)
Definition: open62541.c:18872
#define UA_NS0ID_XMLELEMENT
Definition: open62541.h:1811
void __UA_Client_Service(UA_Client *client, const void *request, const UA_DataType *requestType, void *response, const UA_DataType *responseType)
Definition: open62541.c:25411
UA_StatusCode UA_decodeBinary(const UA_ByteString *src, size_t *offset, void *dst, const UA_DataType *type) UA_FUNC_ATTR_WARN_UNUSED_RESULT
Definition: open62541.c:7310
UA_String UA_DateTime_toString(UA_DateTime t)
Definition: open62541.c:4875
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_BUILDNUMBER
Definition: open62541.h:2549
#define UA_NS0ID_SERVERDIAGNOSTICSTYPE
Definition: open62541.h:2490
#define UA_NS0ID_DELETEREFERENCESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2104
UA_UInt64 u64
Definition: open62541.c:779
#define ANONYMOUS_POLICY
Definition: open62541.c:4146
void MonitoredItem_delete(UA_Server *server, UA_MonitoredItem *monitoredItem)
#define UA_TYPES_BROWSENEXTREQUEST
Definition: open62541.h:4221
#define VERSION(MAJOR, MINOR, PATCH, LABEL)
Definition: open62541.c:27563
void UA_Log_Stdout(UA_LogLevel level, UA_LogCategory category, const char *msg, va_list args)
Definition: open62541.c:27510
UA_ResponseHeader responseHeader
Definition: open62541.h:4760
UA_MessageSecurityMode securityMode
Definition: open62541.c:3233
void UA_Connection_deleteMembers(UA_Connection *connection)
Definition: open62541.c:14858
UA_StatusCode UA_EndpointUrl_split_ptr(const char *endpointUrl, char *hostname, const char **port, const char **path)
Definition: open62541.c:15012
void Service_CreateSubscription(UA_Server *server, UA_Session *session, const UA_CreateSubscriptionRequest *request, UA_CreateSubscriptionResponse *response)
Subscription Service Set Subscriptions are used to report Notifications to the Client.
UA_UInt32 subscriptionId
Definition: open62541.h:3995
#define UA_LOG_TRACE_CHANNEL(LOGGER, CHANNEL, MSG,...)
Log Helper
Definition: open62541.c:3276
#define UA_STATUSCODE_BADEXPECTEDSTREAMTOBLOCK
Definition: open62541.h:875
#define UA_STATUSCODE_BADSTRUCTUREMISSING
Definition: open62541.h:725
UA_StatusCode __UA_Client_writeAttribute(UA_Client *client, const UA_NodeId *nodeId, UA_AttributeId attributeId, const void *in, const UA_DataType *inDataType)
Definition: open62541.c:25753
#define UA_NS0ID_HASEFFECT
Definition: open62541.h:1846
void Service_CreateMonitoredItems(UA_Server *server, UA_Session *session, const UA_CreateMonitoredItemsRequest *request, UA_CreateMonitoredItemsResponse *response)
MonitoredItem Service Set Clients define MonitoredItems to subscribe to data and Events.
UA_DeleteReferencesItem * referencesToDelete
Definition: open62541.h:4750
void Service_Read(UA_Server *server, UA_Session *session, const UA_ReadRequest *request, UA_ReadResponse *response)
Query Service Set This Service Set is used to issue a Query to a Server.
Definition: open62541.c:20851
UA_Boolean discardOldest
Definition: open62541.h:3679
#define UA_TYPES_WRITEVALUE
Definition: open62541.h:3639
#define UA_SECURE_MESSAGE_HEADER_LENGTH
Definition: open62541.c:15152
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_BUILDDATE
Definition: open62541.h:2550
ObjectTypeAttributes ^^^^^^^^^^^^^^^^^^^^ The attributes for an object type node. ...
Definition: open62541.h:3736
UA_ExtensionObject userIdentityToken
Definition: open62541.h:4074
UA_StatusCode UA_Server_deleteReference(UA_Server *server, const UA_NodeId sourceNodeId, const UA_NodeId referenceTypeId, UA_Boolean isForward, const UA_ExpandedNodeId targetNodeId, UA_Boolean deleteBidirectional)
Definition: open62541.c:22488
UA_Boolean UA_String_equal(const UA_String *s1, const UA_String *s2)
Definition: open62541.c:4829
UserTokenPolicy ^^^^^^^^^^^^^^^ Describes a user token that can be used with a server.
Definition: open62541.h:4342
UA_ResponseHeader responseHeader
Definition: open62541.h:4697
UA_Boolean hasInnerDiagnosticInfo
Definition: open62541.h:1594
#define UA_STATUSCODE_BADENTRYEXISTS
Definition: open62541.h:841
#define CHECK_DATATYPE_SCALAR(EXP_DT)
Definition: open62541.c:20990
#define UA_STATUSCODE_BADVIEWVERSIONINVALID
Definition: open62541.h:772
struct UA_DelayedJob UA_DelayedJob
UA_StatusCode * results
Definition: open62541.h:4671
#define UA_NS0ID_HASSUBTYPE
Definition: open62541.h:1838
UA_BrowseResultMask
BrowseResultMask ^^^^^^^^^^^^^^^^ A bit mask which specifies what should be returned in a browse resp...
Definition: open62541.h:3279
#define UA_TYPES_USERTOKENTYPE
Definition: open62541.h:4061
UA_RequestHeader requestHeader
Definition: open62541.h:4465
#define UA_TYPES_ADDREFERENCESRESPONSE
Definition: open62541.h:4852
void(* deleteMembers)(UA_ServerNetworkLayer *nl)
Deletes the network content.
Definition: open62541.h:9799
UA_NodeId sessionId
Definition: open62541.c:3730
UA_StatusCode UA_Client_readArrayDimensionsAttribute(UA_Client *client, const UA_NodeId nodeId, UA_UInt32 **outArrayDimensions, size_t *outArrayDimensionsSize)
Definition: open62541.c:25882
UA_ValueSource
VariableNode
Definition: open62541.c:3438
UA_UInt32 messageSize
Definition: open62541.c:2630
UA_NodeId viewId
Definition: open62541.h:3930
#define UA_TYPES_CLOSESESSIONREQUEST
Definition: open62541.h:4320
#define UA_TYPES_DELETESUBSCRIPTIONSRESPONSE
Definition: open62541.h:4651
UA_ClientState state
Definition: open62541.c:4724
UA_UInt16 year
Definition: open62541.h:1096
UA_UInt32 protocolVersion
Definition: open62541.h:9450
UA_UserTokenPolicy token
Definition: open62541.c:4742
UA_UInt32 subscriptionId
Definition: open62541.h:4454
UA_ResponseHeader responseHeader
Definition: open62541.h:4845
void Service_Call_single(UA_Server *server, UA_Session *session, const UA_CallMethodRequest *request, UA_CallMethodResult *result)
UA_UInt16 UA_Server_run_iterate(UA_Server *server, UA_Boolean waitInternal)
Definition: open62541.c:18500
#define UA_NS0ID_ADDNODESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2086
void * UA_new(const UA_DataType *type)
The following functions are used for generic handling of data types.
Definition: open62541.c:5567
UA_UInt32 requestedMaxKeepAliveCount
Definition: open62541.h:4231
#define UA_STATUSCODE_BADSECURECHANNELTOKENUNKNOWN
Definition: open62541.h:806
#define UA_STATUSCODE_BADSERVERURIINVALID
Definition: open62541.h:739
#define UA_NS0ID_DATAVALUE
Definition: open62541.h:1818
FindServersResponse ^^^^^^^^^^^^^^^^^^^ Finds the servers known to the discovery server.
Definition: open62541.h:4933
UA_StatusCode UA_Server_setVariableNode_valueCallback(UA_Server *server, const UA_NodeId nodeId, const UA_ValueCallback callback)
Definition: open62541.c:22518
#define UA_STATUSCODE_BADNODENOTINVIEW
Definition: open62541.h:738
UA_StatusCode __UA_Server_addNode(UA_Server *server, const UA_NodeClass nodeClass, const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId, const UA_QualifiedName browseName, const UA_NodeId typeDefinition, const UA_NodeAttributes *attr, const UA_DataType *attributeType, UA_InstantiationCallback *instantiationCallback, UA_NodeId *outNewNodeId)
Definition: open62541.c:22026
size_t outputArgumentsSize
Definition: open62541.h:3449
CloseSessionResponse ^^^^^^^^^^^^^^^^^^^^ Closes a session with the server.
Definition: open62541.h:4896
#define UA_TYPES_FINDSERVERSREQUEST
Definition: open62541.h:4565
#define UA_NS0ID_TOSTATE
Definition: open62541.h:1844
UA_StatusCode UA_Server_run(UA_Server *server, volatile UA_Boolean *running)
Definition: open62541.c:18605
#define MANUFACTURER_NAME
Definition: open62541.c:27553
UA_UInt32 maxResponseMessageSize
Definition: open62541.c:3732
UA_NodeId addedNodeId
Definition: open62541.h:3341
UA_DateTime serverTimestamp
Definition: open62541.h:1578
UA_NODE_BASEATTRIBUTES UA_Byte eventNotifier
Definition: open62541.c:3525
UA_String UA_XmlElement
XmlElement ^^^^^^^^^^ An XML element.
Definition: open62541.h:1154
NodeAttributes ^^^^^^^^^^^^^^ The base attributes for all nodes.
Definition: open62541.h:3955
NotificationMessage ^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3373
UA_ExpandedNodeId parentNodeId
Definition: open62541.h:4814
#define UA_TYPES_REPUBLISHREQUEST
Definition: open62541.h:4458
#define SOCKET
Definition: open62541.c:26696
#define UA_STATUSCODE_BADSECURECHANNELIDINVALID
Definition: open62541.h:689
UA_UInt32 userWriteMask
Definition: open62541.h:3355
#define UA_USEC_TO_DATETIME
Definition: open62541.h:1073
#define UA_NS0ID_PROPERTYTYPE
Definition: open62541.h:1852
UA_UInt16 availableContinuationPoints
Definition: open62541.c:3736
void Service_CloseSession(UA_Server *server, UA_Session *session, const UA_CloseSessionRequest *request, UA_CloseSessionResponse *response)
Definition: open62541.c:20027
#define UA_TYPES_BROWSEPATHRESULT
Definition: open62541.h:4269
#define UA_TRANSPORT_SYMMETRICALGORITHMSECURITYHEADER
Definition: open62541.c:2657
#define UA_NS0ID_HASTYPEDEFINITION
Definition: open62541.h:1835
#define UA_MINMESSAGESIZE
Definition: open62541.c:24718
#define UA_PRINTF_STRING_DATA(STRING)
Definition: open62541.h:9732
#define UA_NS0ID_HIERARCHICALREFERENCES
Definition: open62541.h:1828
UA_BrowsePathTarget * targets
Definition: open62541.h:4266
Networking Client-server connection is represented by a UA_Connection structure.
Definition: open62541.h:9449
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO
Definition: open62541.h:2544
#define UA_NS0ID_TYPESFOLDER
Definition: open62541.h:1864
#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS_ENABLEDFLAG
Definition: open62541.h:2571
UA_WriteValue * nodesToWrite
Definition: open62541.h:4413
#define UA_TYPES_DELETENODESITEM
Definition: open62541.h:3856
UA_DataValue UA_Server_read(UA_Server *server, const UA_ReadValueId *item, UA_TimestampsToReturn timestamps)
Reading and Writing Node Attributes The functions for reading and writing node attributes call the re...
Definition: open62541.c:20927
UA_NodeId startingNode
Definition: open62541.h:5015
#define UA_STATUSCODE_BADTOOMANYARGUMENTS
Definition: open62541.h:699
UA_UInt32 attributeId
Definition: open62541.h:3875
#define UA_NS0ID_CREATESUBSCRIPTIONREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2385
DataChangeFilter ^^^^^^^^^^^^^^^^.
Definition: open62541.h:4872
UA_MonitoredItemCreateRequest * itemsToCreate
Definition: open62541.h:4950
UA_ClientConfig config
Definition: open62541.c:4725
#define UA_STATUSCODE_BADBOUNDNOTFOUND
Definition: open62541.h:837
MethodAttributes ^^^^^^^^^^^^^^^^ The attributes for a method node.
Definition: open62541.h:3602
UnregisterNodesRequest ^^^^^^^^^^^^^^^^^^^^^^ Unregisters one or more previously registered nodes...
Definition: open62541.h:3513
#define UA_NS0ID_BYTESTRING
Definition: open62541.h:1810
UA_NodeClass nodeClass
Definition: open62541.h:4577
#define UA_STATUSCODE_BADNOCOMMUNICATION
Definition: open62541.h:704
UA_ByteString byteString
Definition: open62541.h:1178
#define UA_TYPES_SERVERSTATUSDATATYPE
Definition: open62541.h:4838
#define UA_STATUSCODE_BADTIMESTAMPSTORETURNINVALID
Definition: open62541.h:697
#define UA_NS0ID_DOUBLE
Definition: open62541.h:1806
#define UA_TYPES_DATACHANGENOTIFICATION
Definition: open62541.h:4512
#define UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_TEXT
Definition: open62541.c:6624
#define UA_STRING_STATIC_NULL
Definition: open62541.c:27560
#define UA_STATUSCODE_BADINVALIDARGUMENT
Definition: open62541.h:866
void Service_SetMonitoringMode(UA_Server *server, UA_Session *session, const UA_SetMonitoringModeRequest *request, UA_SetMonitoringModeResponse *response)
void Service_FindServers(UA_Server *server, UA_Session *session, const UA_FindServersRequest *request, UA_FindServersResponse *response)
Discovery Service Set This Service Set defines Services used to discover the Endpoints implemented by...
Definition: open62541.c:19717
#define UA_STATUSCODE_GOODPOSTACTIONFAILED
Definition: open62541.h:856
#define UA_STATUSCODE_UNCERTAINSUBNORMAL
Definition: open62541.h:821
UA_StatusCode(* start)(UA_ServerNetworkLayer *nl, UA_Logger logger)
Definition: open62541.h:9774
#define UA_fd_isset(fd, fds)
Definition: open62541.c:26726
UA_NumericRangeDimension * dimensions
Definition: open62541.h:1348
UA_ResponseHeader responseHeader
Definition: open62541.h:4897
#define UA_STATUSCODE_GOODCOMMUNICATIONEVENT
Definition: open62541.h:862
const UA_calcSizeBinarySignature calcSizeBinaryJumpTable[UA_BUILTIN_TYPES_COUNT+1]
Definition: open62541.c:7524
#define UA_NODESTORE_MINSIZE
Definition: open62541.c:19152
#define UA_NS0ID_NODEID
Definition: open62541.h:1812
UA_StatusCode statusCode
Definition: open62541.h:3444
#define UA_STATUSCODE_BADOBJECTDELETED
Definition: open62541.h:718
UA_Boolean hasNamespaceUri
Definition: open62541.h:1589
#define UA_STATUSCODE_BADTCPENDPOINTURLINVALID
Definition: open62541.h:802
UA_DateTime validTill
Definition: open62541.c:3734
union UA_ExtensionObject::@1 content
UA_StatusCode * results
Definition: open62541.h:4001
UA_SubscriptionState
Definition: open62541.c:3885
UA_ApplicationDescription server
Definition: open62541.h:5070
UA_NodeId nodeId
Definition: open62541.h:3633
#define UA_STATUSCODE_GOODSHUTDOWNEVENT
Definition: open62541.h:863
#define UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE
Definition: open62541.h:4866
#define UA_STATUSCODE_BADSECURITYMODEREJECTED
Definition: open62541.h:744
#define UA_NS0ID_SERVER_SERVERSTATUS_SHUTDOWNREASON
Definition: open62541.h:2634
UA_Boolean deleteTargetReferences
Definition: open62541.h:3853
UA_NodeId sourceNodeId
Definition: open62541.h:4615
#define UA_TRANSPORT_ASYMMETRICALGORITHMSECURITYHEADER
Definition: open62541.c:2597
TcpHelloMessage ^^^^^^^^^^^^^^^ Hello Message.
Definition: open62541.c:2548
#define UA_STATUSCODE_BADNODECLASSINVALID
Definition: open62541.h:756
UA_Subscription * UA_Subscription_new(UA_Session *session, UA_UInt32 subscriptionID)
ChannelSecurityToken ^^^^^^^^^^^^^^^^^^^^ The token that identifies a set of keys for an active secur...
Definition: open62541.h:3827
UA_Client_Authentication authenticationMethod
Definition: open62541.c:4737
#define UA_TYPES_NODEATTRIBUTES
Definition: open62541.h:3963
#define UA_TYPES_MODIFYMONITOREDITEMSRESPONSE
Definition: open62541.h:4767
#define UA_TYPES_DEADBANDTYPE
Definition: open62541.h:3759
UA_UInt16 month
Definition: open62541.h:1095
Server Configuration The following structure is passed to a new server for configuration.
Definition: open62541.h:9806
#define UA_TYPES_REFERENCETYPEATTRIBUTES
Definition: open62541.h:4380
#define UA_STATUSCODE_BADCERTIFICATEREVOKED
Definition: open62541.h:683
#define UA_NS0ID_CREATEMONITOREDITEMSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2349
UA_UInt32 writeMask
Definition: open62541.h:3959
#define UA_STATUSCODE_BADNOMATCH
Definition: open62541.h:779
#define UA_STATUSCODE_GOODEDITED
Definition: open62541.h:855
UA_AttributeId
Standard-Defined Constants This section contains numerical and string constants that are defined in t...
Definition: open62541.h:577
#define TAILQ_FIRST(head)
Definition: open62541.c:450
UA_UInt32 data1
Definition: open62541.h:1108
#define UA_TYPES_CALLREQUEST
Definition: open62541.h:3596
ViewAttributes ^^^^^^^^^^^^^^ The attributes for a view node.
Definition: open62541.h:3263
#define UA_ASSERT_RCU_LOCKED()
Definition: open62541.c:4179
#define UA_NS0ID_UINT16
Definition: open62541.h:1800
#define UA_TRANSPORT_SECURECONVERSATIONMESSAGEHEADER
Definition: open62541.c:2668
#define UA_NS0ID_SERVER_SERVERSTATUS_BUILDINFO_PRODUCTNAME
Definition: open62541.h:2545
UA_Boolean historizing
Definition: open62541.c:3466
UA_StatusCode status
Definition: open62541.c:781
enum UA_NodeIdType identifierType
Definition: open62541.h:1173
#define UA_STATUSCODE_BADTOOMANYSUBSCRIPTIONS
Definition: open62541.h:789
#define UA_STATUSCODE_BADSEMPAHOREFILEMISSING
Definition: open62541.h:742
UA_NodeId nodeId
Definition: open62541.h:3874
#define UA_STATUSCODE_BADDISCOVERYURLMISSING
Definition: open62541.h:741
UA_BrowseDescription * nodesToBrowse
Definition: open62541.h:5005
#define UA_NS0ID_MODELLINGRULE_MANDATORY
Definition: open62541.h:1858
DeleteNodesItem ^^^^^^^^^^^^^^^ A request to delete a node to the server address space.
Definition: open62541.h:3851
size_t referencesSize
Definition: open62541.h:5028
#define UA_NodeStore_newDataTypeNode()
Definition: open62541.c:3999
UA_CallMethodRequest * methodsToCall
Definition: open62541.h:3593
struct UA_NodeStoreEntry UA_NodeStoreEntry
UA_MessageSecurityMode securityMode
Definition: open62541.h:4292
UA_Boolean isInverse
Definition: open62541.h:3701
#define UA_LOG_ERROR_CHANNEL(LOGGER, CHANNEL, MSG,...)
Definition: open62541.c:3296
UA_MonitoredItemModifyRequest * itemsToModify
Definition: open62541.h:4533
int16_t UA_Int16
Int16 ^^^^^ An integer value between -32 768 and 32 767.
Definition: open62541.h:946
UA_StatusCode UA_EndpointUrl_split(const char *endpointUrl, char *hostname, UA_UInt16 *port, const char **path)
EndpointURL Helper ^^^^^^^^^^^^^^^^^^.
Definition: open62541.c:15077
UA_Boolean includeSubtypes
Definition: open62541.h:4441
#define MAXTIMEOUT
There are four types of job execution:
Definition: open62541.c:17953
UA_UInt16 chunksSoFar
Definition: open62541.c:3226
#define UA_TRANSPORT_CHUNKTYPE
Definition: open62541.c:2647
UA_StatusCode UA_Server_deleteNode(UA_Server *server, const UA_NodeId nodeId, UA_Boolean deleteReferences)
Definition: open62541.c:22402
#define UA_NS0ID_SERVER_SERVERSTATUS_STARTTIME
Definition: open62541.h:2541
#define UA_STATUSCODE_BADCERTIFICATEISSUERTIMEINVALID
Definition: open62541.h:675
void Service_CloseSecureChannel(UA_Server *server, UA_SecureChannel *channel)
Definition: open62541.c:19875
UA_NODE_BASEATTRIBUTES UA_NODE_VARIABLEATTRIBUTES UA_Boolean isAbstract
Definition: open62541.c:3484
QueryDataDescription ^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:5056
#define UA_OPEN62541_VER_MINOR
Definition: open62541.h:40
void * methodHandle
Definition: open62541.c:3511
UA_StatusCode UA_SecureChannelManager_init(UA_SecureChannelManager *cm, UA_Server *server)
Definition: open62541.c:18625
size_t elementsSize
Definition: open62541.h:4658
UA_UInt32 receiveBufferSize
Definition: open62541.c:2550
UA_NodeId authenticationToken
Definition: open62541.h:3301
UA_NODE_BASEATTRIBUTES UA_Boolean isAbstract
Definition: open62541.c:3673
UA_ResponseHeader responseHeader
Definition: open62541.h:4401
#define UA_TYPES_BYTE
Byte ^^^^.
Definition: open62541.h:3103
UA_LocalizedText displayName
Definition: open62541.h:4576
BrowseNextResponse ^^^^^^^^^^^^^^^^^^ Continues one or more browse operations.
Definition: open62541.h:5111
#define UA_NS0ID_BASEOBJECTTYPE
Definition: open62541.h:1848
DeleteReferencesItem ^^^^^^^^^^^^^^^^^^^^ A request to delete a node from the server address space...
Definition: open62541.h:3618
int32_t UA_Int32
Int32 ^^^^^ An integer value between -2 147 483 648 and 2 147 483 647.
Definition: open62541.h:962
void UA_Session_updateLifetime(UA_Session *session)
Definition: open62541.c:15667
#define UA_STATUSCODE_UNCERTAINDOMINANTVALUECHANGED
Definition: open62541.h:857
MonitoredItemCreateResult ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3645
UA_StatusCode serviceResult
Definition: open62541.h:3904
#define UA_STATUSCODE_BADSECURECHANNELCLOSED
Definition: open62541.h:805
UA_ConnectionConfig localConf
Definition: open62541.h:9480
UA_DateTime UA_DateTime_nowMonotonic(void)
Definition: open62541.c:27461
UA_String encryptionAlgorithm
Definition: open62541.h:4027
UA_UInt16 namespaceIndex
Definition: open62541.h:1172
UA_ExpandedNodeId targetId
Definition: open62541.h:3702
const UA_String UA_STRING_NULL
Definition: open62541.c:4772
#define UA_STATUSCODE_GOODRESULTSMAYBEINCOMPLETE
Definition: open62541.h:774
UA_ByteString * continuationPoints
Definition: open62541.h:4218
UA_UInt32 UA_UInt32_random(void)
Definition: open62541.c:4801
#define UA_TYPES_MONITORINGPARAMETERS
Definition: open62541.h:3682
UA_ExpandedNodeId nodeId
Definition: open62541.h:4574
ExpandedNodeId ^^^^^^^^^^^^^^ A NodeId that allows the namespace URI to be specified instead of an in...
Definition: open62541.h:1238
UA_UInt32 writeMask
Definition: open62541.h:4426
ParsingResult ^^^^^^^^^^^^^.
Definition: open62541.h:3459
UA_UInt16 addNamespace(UA_Server *server, const UA_String name)
Definition: open62541.c:15750
#define UA_PRINTF_GUID_FORMAT
Convenience macros for complex types ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:9726
CallMethodRequest ^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3500
void Service_DeleteSubscriptions(UA_Server *server, UA_Session *session, const UA_DeleteSubscriptionsRequest *request, UA_DeleteSubscriptionsResponse *response)
UA_Boolean isAbstract
Definition: open62541.h:3892
UA_UInt32 maxNotificationsPerPublish
Definition: open62541.h:4232
UA_UInt32 sendBufferSize
Definition: open62541.h:9451
Definition: open62541.c:3209
#define UA_STATUSCODE_BADPROTOCOLVERSIONUNSUPPORTED
Definition: open62541.h:808
#define UA_STATUSCODE_BADSEQUENCENUMBERUNKNOWN
Definition: open62541.h:792
#define UA_realloc(ptr, size)
Definition: open62541.h:105
ObjectNode
Definition: open62541.c:3523
#define WIN32_INT
Definition: open62541.c:26697
UA_RequestHeader requestHeader
Definition: open62541.h:4480
#define UA_NS0ID_STATUSCODE
Definition: open62541.h:1814
UA_ExpandedNodeId targetNodeId
Definition: open62541.h:4619
UA_ByteString serverCertificate
Definition: open62541.h:5157
ActivateSessionResponse ^^^^^^^^^^^^^^^^^^^^^^^ Activates a session with the server.
Definition: open62541.h:4144
VariableAttributes ^^^^^^^^^^^^^^^^^^ The attributes for a variable node.
Definition: open62541.h:3350
#define UA_STATUSCODE_BADSERVERINDEXINVALID
Definition: open62541.h:768
UA_IdType
IdType ^^^^^^ The type of identifier used in a node id.
Definition: open62541.h:4036
UA_StatusCode UA_Subscription_removeRetransmissionMessage(UA_Subscription *sub, UA_UInt32 sequenceNumber)
void UA_random_seed(UA_UInt64 seed)
Random Number Generator If UA_ENABLE_MULTITHREADING is defined, then the seed is stored in thread loc...
Definition: open62541.c:4796
UA_ResponseHeader responseHeader
Definition: open62541.h:4588
#define UA_STATUSCODE_BADREQUESTTYPEINVALID
Definition: open62541.h:743
#define UA_TYPES_SERVICEFAULT
Definition: open62541.h:4927
UA_DateTime currentTime
Definition: open62541.h:4831
#define UA_TYPES_APPLICATIONTYPE
Definition: open62541.h:4106
UA_StatusCode UA_NodeStore_replace(UA_NodeStore *ns, UA_Node *node)
Definition: open62541.c:19411
UA_Boolean deleteSubscriptions
Definition: open62541.h:4317
const char * LogLevelNames[6]
Definition: open62541.c:27500
UA_ChunkType
ChunkType ^^^^^^^^^ Type of the chunk.
Definition: open62541.c:2639
UA_UInt16 serverPicoseconds
Definition: open62541.h:1579
UA_ApplicationDescription clientDescription
Definition: open62541.c:3726
WriteResponse ^^^^^^^^^^^^^.
Definition: open62541.h:4200
SubscriptionAcknowledgement ^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3862
void UA_Server_delete(UA_Server *server)
Definition: open62541.c:15869
UA_Double minimumSamplingInterval
Definition: open62541.h:3363
UA_StatusCode UA_Variant_setArrayCopy(UA_Variant *v, const void *array, size_t arraySize, const UA_DataType *type)
Definition: open62541.c:5189
#define UA_STATUSCODE_BADSYNTAXERROR
Definition: open62541.h:877
#define UA_TYPES_MONITOREDITEMNOTIFICATION
Definition: open62541.h:3845
#define UA_STATUSCODE_BADREFERENCENOTALLOWED
Definition: open62541.h:753
UA_CallMethodResult * results
Definition: open62541.h:4699
#define UA_NS0ID_SERVER_SERVERSTATUS_CURRENTTIME
Definition: open62541.h:2542
UserIdentityToken ^^^^^^^^^^^^^^^^^ A base type for a user identity token.
Definition: open62541.h:3726
UA_Boolean isForward
Definition: open62541.h:4617
#define DOUBLE_NEG_INF
Definition: open62541.c:6200
UA_StatusCode(* send)(UA_Connection *connection, UA_ByteString *buf)
Definition: open62541.h:9504
UA_StatusCode UA_Client_addReference(UA_Client *client, const UA_NodeId sourceNodeId, const UA_NodeId referenceTypeId, UA_Boolean isForward, const UA_String targetServerUri, const UA_ExpandedNodeId targetNodeId, UA_NodeClass targetNodeClass)
Definition: open62541.c:25568
#define UA_NS0ID_ACTIVATESESSIONREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2065
#define UA_TYPES_DATACHANGETRIGGER
Definition: open62541.h:3786
#define UA_STATUSCODE_BADSEQUENCENUMBERINVALID
Definition: open62541.h:807
QueryNextResponse ^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4131
UA_NodeAttributesMask
NodeAttributesMask ^^^^^^^^^^^^^^^^^^ The bits used to specify default attributes for a new node...
Definition: open62541.h:3386
#define UA_TYPES_VARIABLEATTRIBUTES
Definition: open62541.h:3367
#define UA_NS0ID_DELETEMONITOREDITEMSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2379
UA_Boolean releaseContinuationPoints
Definition: open62541.h:4216
#define UA_TYPES_CALLMETHODREQUEST
Definition: open62541.h:3507
#define UA_NODEIDTYPE_NUMERIC_FOURBYTE
Definition: open62541.c:6446
#define UA_STATUSCODE_BADOUTOFMEMORY
Definition: open62541.h:654
UA_LocalizedText inverseName
Definition: open62541.c:3654
#define UA_STATUSCODE_BADCONDITIONBRANCHALREADYACKED
Definition: open62541.h:831
#define UA_NodeStore_newObjectNode()
Definition: open62541.c:3987
#define UA_TYPES_CHANNELSECURITYTOKEN
Definition: open62541.h:3834
UA_MethodCallback attachedMethod
Definition: open62541.c:3512
#define UA_TYPES_BOOLEAN
Boolean ^^^^^^^.
Definition: open62541.h:3091
#define UA_STATUSCODE_BADSESSIONNOTACTIVATED
Definition: open62541.h:694
#define UA_STATUSCODE_GOODCOMPLETESASYNCHRONOUSLY
Definition: open62541.h:701
#define SIMPLEQ_REMOVE_HEAD(head, field)
Definition: open62541.c:338
#define UA_NS0ID_SERVER_SERVERARRAY
Definition: open62541.h:2538
UA_ResponseHeader responseHeader
Definition: open62541.h:4711
#define UA_STATUSCODE_BADMAXCONNECTIONSREACHED
Definition: open62541.h:878
UA_MonitoredItem * UA_Subscription_getMonitoredItem(UA_Subscription *sub, UA_UInt32 monitoredItemID)
#define UA_TYPES_BROWSEDESCRIPTION
Definition: open62541.h:4446
#define UA_TYPES_CONTENTFILTERELEMENTRESULT
Definition: open62541.h:3533
#define UA_STATUSCODE_BADBOUNDNOTSUPPORTED
Definition: open62541.h:838
#define UA_TYPES_REFERENCENODE
Definition: open62541.h:3705
UA_UInt32 userWriteMask
Definition: open62541.h:4427
#define UA_NODEIDTYPE_NUMERIC_COMPLETE
Definition: open62541.c:6447
#define UA_STATUSCODE_BADCERTIFICATEISSUERREVOCATIONUNKNOWN
Definition: open62541.h:682
void UA_Subscription_deleteMembers(UA_Subscription *subscription, UA_Server *server)
#define UA_STATUSCODE_BADSERVICEUNSUPPORTED
Definition: open62541.h:664
UA_UInt32 maxNotificationsPerPublish
Definition: open62541.h:4332
Guid ^^^^ A 16 byte value that can be used as a globally unique identifier.
Definition: open62541.h:1107
UA_MessageSecurityMode
MessageSecurityMode ^^^^^^^^^^^^^^^^^^^ The type of security to use on a message. ...
Definition: open62541.h:3659
UA_UInt16 microSec
Definition: open62541.h:1089
UA_StatusCode UA_Node_copyAnyNodeClass(const UA_Node *src, UA_Node *dst)
Definition: open62541.c:19075
UA_Boolean hasSymbolicId
Definition: open62541.h:1588
String ^^^^^^ A sequence of Unicode characters.
Definition: open62541.h:1038
#define UA_STATUSCODE_BADRESOURCEUNAVAILABLE
Definition: open62541.h:655
const UA_Node * UA_NodeStore_get(UA_NodeStore *ns, const UA_NodeId *nodeid)
Definition: open62541.c:19427
MonitoringParameters ^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3674
#define SIMPLEQ_HEAD(name, type)
Definition: open62541.c:280
UA_DeadbandType
DeadbandType ^^^^^^^^^^^^.
Definition: open62541.h:3751
UA_Int32 valueRank
Definition: open62541.h:3714
UA_ResponseHeader responseHeader
Definition: open62541.h:5138
#define UA_TYPES_MONITOREDITEMMODIFYRESULT
Definition: open62541.h:3323
#define UA_assert(ignore)
Definition: open62541.c:744
#define UA_NS0ID_DELETESUBSCRIPTIONSREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2439
#define SIMPLEQ_INIT(head)
Definition: open62541.c:315
#define UA_TRANSPORT_SECURECONVERSATIONMESSAGEFOOTER
Definition: open62541.c:2542
void UA_Connection_attachSecureChannel(UA_Connection *connection, UA_SecureChannel *channel)
Definition: open62541.c:15005
type_equivalence
Definition: open62541.c:20057
UA_StatusCode UA_Server_setObjectTypeNode_lifecycleManagement(UA_Server *server, UA_NodeId nodeId, UA_ObjectLifecycleManagement olm)
Definition: open62541.c:22567
UA_NodeId authenticationToken
Definition: open62541.c:3729
#define UA_TYPES_VIEWATTRIBUTES
Definition: open62541.h:3273
#define UA_STATUSCODE_BADTOOMANYPUBLISHREQUESTS
Definition: open62541.h:790
UA_RequestHeader requestHeader
Definition: open62541.h:5039
size_t(* stop)(UA_ServerNetworkLayer *nl, UA_Job **jobs)
Definition: open62541.h:9796
UA_UInt32 receiveSequenceNumber
Definition: open62541.c:3240
#define UA_STATUSCODE_BADNODELETERIGHTS
Definition: open62541.h:766
#define UA_STATUSCODE_BADPARENTNODEIDINVALID
Definition: open62541.h:752
UA_String discoveryUrl
Definition: open62541.h:9767
DeleteMonitoredItemsRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4356
#define UA_STATUSCODE_BADEVENTNOTACKNOWLEDGEABLE
Definition: open62541.h:828
UA_StatusCode UA_Connection_completeMessages(UA_Connection *connection, UA_ByteString *message, UA_Boolean *realloced)
Definition: open62541.c:14863
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_AGGREGATEFUNCTIONS
Definition: open62541.h:2637
#define UA_STATUSCODE_BADNONCEINVALID
Definition: open62541.h:691
UA_Boolean UA_NodeId_isNull(const UA_NodeId *p)
Definition: open62541.c:4981
UA_StatusCode statusCode
Definition: open62541.h:3340
void UA_Node_deleteMembersAnyNodeClass(UA_Node *node)
Definition: open62541.c:18944
#define UA_TYPES_LOCALIZEDTEXT
LocalizedText ^^^^^^^^^^^^^.
Definition: open62541.h:3211
AddReferencesResponse ^^^^^^^^^^^^^^^^^^^^^ Adds one or more references to the server address space...
Definition: open62541.h:4844
const UA_EXPORT UA_ServerConfig UA_ServerConfig_standard
Definition: open62541.c:27570
UA_Byte membersSize
Definition: open62541.h:1657
UA_Boolean hasStatus
Definition: open62541.h:1569
UA_StatusCode(* UA_NodeIteratorCallback)(UA_NodeId childId, UA_Boolean isInverse, UA_NodeId referenceTypeId, void *handle)
Definition: open62541.h:10250
UA_Boolean userExecutable
Definition: open62541.h:3609
UA_Double requestedPublishingInterval
Definition: open62541.h:4329
#define UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSREQUEST
Definition: open62541.h:5131
UA_ConnectionConfig remoteConf
Definition: open62541.h:9481
UA_BrowseResult UA_Server_browseNext(UA_Server *server, UA_Boolean releaseContinuationPoint, const UA_ByteString *continuationPoint)
Definition: open62541.c:22926
const UA_Node * getNodeType(UA_Server *server, const UA_Node *node)
Definition: open62541.c:17818
#define UA_TYPES_RESPONSEHEADER
Definition: open62541.h:3911
UA_StatusCode UA_Server_run_shutdown(UA_Server *server)
Definition: open62541.c:18569
#define UA_STATUSCODE_BADIDENTITYTOKENREJECTED
Definition: open62541.h:688
#define UA_NODE_VARIABLEATTRIBUTES
Definition: open62541.c:3443
#define UA_STATUSCODE_BADSESSIONCLOSED
Definition: open62541.h:693
UA_ResponseHeader responseHeader
Definition: open62541.h:4669
#define DOUBLE_NAN
Definition: open62541.c:6198
#define UA_STATUSCODE_GOOD
Definition: open62541.h:651
UA_String locale
Definition: open62541.h:1314
#define UA_STATUSCODE_BADNOTTYPEDEFINITION
Definition: open62541.h:775
#define UA_STATUSCODE_BADNOTHINGTODO
Definition: open62541.h:668
Definition: open62541.c:19154
#define UA_NS0ID_REGISTERNODESREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2158
UA_Guid guid
Definition: open62541.h:1177
#define UA_STATUSCODE_GOODCLAMPED
Definition: open62541.h:703
UA_NodeId nodeId
Definition: open62541.h:1239
UA_EXPORT const UA_DataType UA_TRANSPORT[UA_TRANSPORT_COUNT]
Definition: open62541.c:14679
struct UA_SecureChannelManager UA_SecureChannelManager
UA_ExpandedNodeId requestedNewNodeId
Definition: open62541.h:4816
#define UA_STATUSCODE_BADNOTREADABLE
Definition: open62541.h:713
UA_StatusCode UA_Variant_setScalarCopy(UA_Variant *v, const void *p, const UA_DataType *type)
Definition: open62541.c:5164
#define UA_RCU_LOCK()
Definition: open62541.c:4177
void UA_SecureChannel_detachSession(UA_SecureChannel *channel, UA_Session *session)
Definition: open62541.c:15224
#define UA_TYPES_UNREGISTERNODESRESPONSE
Definition: open62541.h:4404
void Service_ModifySubscription(UA_Server *server, UA_Session *session, const UA_ModifySubscriptionRequest *request, UA_ModifySubscriptionResponse *response)
#define WOULDBLOCK
Definition: open62541.c:26744
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MAXHISTORYCONTINUATIONPOINTS
Definition: open62541.h:2613
UA_StatusCode typeCheckValue(UA_Server *server, const UA_NodeId *targetDataTypeId, UA_Int32 targetValueRank, size_t targetArrayDimensionsSize, const UA_UInt32 *targetArrayDimensions, const UA_Variant *value, const UA_NumericRange *range, UA_Variant *editableValue)
Definition: open62541.c:20185
#define UA_NS0ID_ROOTFOLDER
Definition: open62541.h:1862
UA_ResponseHeader responseHeader
Definition: open62541.h:3942
UA_StatusCode UA_Client_getEndpoints(UA_Client *client, const char *serverUrl, size_t *endpointDescriptionsSize, UA_EndpointDescription **endpointDescriptions)
Definition: open62541.c:25206
int8_t UA_SByte
SByte ^^^^^ An integer value between -128 and 127.
Definition: open62541.h:930
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_LOCALEIDARRAY
Definition: open62541.h:2554
UA_Boolean UA_NodeId_equal(const UA_NodeId *n1, const UA_NodeId *n2)
Definition: open62541.c:5006
#define UA_TYPES_FILTEROPERATOR
Definition: open62541.h:4182
#define UA_TYPES_CLOSESECURECHANNELREQUEST
Definition: open62541.h:3333
#define UA_NS0ID_SETMONITORINGMODEREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2367
CloseSessionRequest ^^^^^^^^^^^^^^^^^^^ Closes a session with the server.
Definition: open62541.h:4315
#define UA_STATUSCODE_BADCERTIFICATETIMEINVALID
Definition: open62541.h:674
ReadResponse ^^^^^^^^^^^^.
Definition: open62541.h:4773
#define UA_STATUSCODE_GOODSUBSCRIPTIONTRANSFERRED
Definition: open62541.h:700
UA_BrowseDirection
BrowseDirection ^^^^^^^^^^^^^^^ The directions of the references to return.
Definition: open62541.h:3486
#define UA_NS0ID_DATETIME
Definition: open62541.h:1808
WriteRequest ^^^^^^^^^^^^.
Definition: open62541.h:4410
const UA_StatusCodeDescription * UA_StatusCode_description(UA_StatusCode code)
Definition: open62541.c:26650
UA_StatusCode MonitoredItem_unregisterSampleJob(UA_Server *server, UA_MonitoredItem *mon)
#define UA_TYPES_VIEWDESCRIPTION
Definition: open62541.h:3935
UA_ConnectionConfig conf
Definition: open62541.c:26924
void UA_NodeStore_delete(UA_NodeStore *ns)
Definition: open62541.c:19343
#define UA_TYPES_QUERYFIRSTREQUEST
Definition: open62541.h:5182
#define UA_NS0ID_SERVER_SERVERSTATUS
Definition: open62541.h:2540
#define UA_NS0ID_STRUCTURE
Definition: open62541.h:1817
UA_StatusCode parse_numericrange(const UA_String *str, UA_NumericRange *range)
Definition: open62541.c:17663
UA_Boolean isArray
Definition: open62541.h:1647
#define UA_STATUSCODE_BADUSERACCESSDENIED
Definition: open62541.h:686
#define UA_STATUSCODE_UNCERTAINNOTALLNODESAVAILABLE
Definition: open62541.h:773
#define UA_NS0ID_SETPUBLISHINGMODEREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2397
UA_StatusCode writeValueRankAttribute(UA_Server *server, UA_VariableNode *node, UA_Int32 valueRank, UA_Int32 constraintValueRank)
Definition: open62541.c:20324
void Service_AddNodes(UA_Server *server, UA_Session *session, const UA_AddNodesRequest *request, UA_AddNodesResponse *response)
NodeManagement Service Set This Service Set defines Services to add and delete AddressSpace Nodes and...
Definition: open62541.c:22001
UA_StatusCode __UA_Client_addNode(UA_Client *client, const UA_NodeClass nodeClass, const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId, const UA_QualifiedName browseName, const UA_NodeId typeDefinition, const UA_NodeAttributes *attr, const UA_DataType *attributeType, UA_NodeId *outNewNodeId)
Definition: open62541.c:25658
#define UA_UINT32_MAX
Definition: open62541.h:972
#define UA_STATUSCODE_BADDATAENCODINGUNSUPPORTED
Definition: open62541.h:712
ActivateSessionRequest ^^^^^^^^^^^^^^^^^^^^^^ Activates a session with the server.
Definition: open62541.h:4067
UA_NodeClass nodeClass
Definition: open62541.h:4818
#define FLOAT_NEG_INF
Definition: open62541.c:6165
#define UA_STATUSCODE_BADCONNECTIONCLOSED
Definition: open62541.h:869
UA_SecureChannel * channel
Definition: open62541.c:3223
UA_Byte * data
Definition: open62541.h:1040
UA_StatusCode UA_SecureChannel_sendBinaryMessage(UA_SecureChannel *channel, UA_UInt32 requestId, const void *content, const UA_DataType *contentType)
Definition: open62541.c:15335
#define UA_STATUSCODE_GOODENTRYINSERTED
Definition: open62541.h:844
#define UA_STATUSCODE_BADCOMMUNICATIONERROR
Definition: open62541.h:656
#define UA_TYPES_STATUSCODE
StatusCode ^^^^^^^^^^.
Definition: open62541.h:3199
ResponseHeader ^^^^^^^^^^^^^^ The header passed with every server response.
Definition: open62541.h:3901
void UA_SessionManager_deleteMembers(UA_SessionManager *sm)
Definition: open62541.c:18819
size_t(* UA_calcSizeBinarySignature)(const void *UA_RESTRICT p, const UA_DataType *contenttype)
Definition: open62541.c:5861
void * data
Definition: open62541.h:1403
#define UA_TYPES_BROWSEDIRECTION
Definition: open62541.h:3494
void * instanceHandle
Definition: open62541.c:3528
CloseSecureChannelRequest ^^^^^^^^^^^^^^^^^^^^^^^^^ Closes a secure channel.
Definition: open62541.h:3329
#define UA_STATUSCODE_BADREQUESTHEADERINVALID
Definition: open62541.h:696
#define UA_TYPES_REGISTERNODESREQUEST
Definition: open62541.h:3975
#define UA_TYPES_EXTENSIONOBJECT
ExtensionObject ^^^^^^^^^^^^^^^.
Definition: open62541.h:3217
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_MODELLINGRULES
Definition: open62541.h:2636
#define UA_TYPES_UNREGISTERNODESREQUEST
Definition: open62541.h:3519
#define PCG32_INITIALIZER
Definition: open62541.c:716
UA_SessionManager sessionManager
Definition: open62541.c:4208
UA_ResponseHeader responseHeader
Definition: open62541.h:4543
UA_UInt32 requestedMaxKeepAliveCount
Definition: open62541.h:4331
SetMonitoringModeResponse ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4542
#define UA_TYPES_BROWSERESULT
Definition: open62541.h:5032
ServerStatusDataType ^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4829
UA_ByteString serverNonce
Definition: open62541.c:3239
void(* releaseSendBuffer)(UA_Connection *connection, UA_ByteString *buf)
Definition: open62541.h:9496
UA_UInt32 count
Definition: open62541.c:19164
UA_Connection * closeConnection
Definition: open62541.h:9587
#define LIST_FOREACH_SAFE(var, head, field, tvar)
Definition: open62541.c:224
void Service_DeleteReferences(UA_Server *server, UA_Session *session, const UA_DeleteReferencesRequest *request, UA_DeleteReferencesResponse *response)
Definition: open62541.c:22465
UA_UInt32 UA_NodeId_hash(const UA_NodeId *n)
Definition: open62541.c:5042
void Service_GetEndpoints(UA_Server *server, UA_Session *session, const UA_GetEndpointsRequest *request, UA_GetEndpointsResponse *response)
Definition: open62541.c:19755
UA_NodeId referenceTypeId
Definition: open62541.h:4815
UA_StatusCode UA_Variant_setRange(UA_Variant *v, void *UA_RESTRICT array, size_t arraySize, const UA_NumericRange range)
Definition: open62541.c:5485
size_t methodsToCallSize
Definition: open62541.h:3592
UA_NodeId typeId
Definition: open62541.h:1654
#define UA_STATUSCODE_BADSECURITYMODEINSUFFICIENT
Definition: open62541.h:781
BrowsePath ^^^^^^^^^^ A request to translate a path into a node id.
Definition: open62541.h:5014
#define UA_TYPES_QUERYNEXTRESPONSE
Definition: open62541.h:4138
DeleteSubscriptionsResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4643
RelativePathElement ^^^^^^^^^^^^^^^^^^^ An element in a relative path.
Definition: open62541.h:3473
#define UA_STATUSCODE_BADSECURITYCHECKSFAILED
Definition: open62541.h:673
UA_LocalizedText displayName
Definition: open62541.h:3957
UA_NotificationMessage notificationMessage
Definition: open62541.h:3999
UA_FilterOperator
FilterOperator ^^^^^^^^^^^^^^.
Definition: open62541.h:4159
#define UA_STATUSCODE_BADCONDITIONNOTSHELVED
Definition: open62541.h:834
#define UA_TYPES_MONITOREDITEMCREATERESULT
Definition: open62541.h:3653
UA_String string
Definition: open62541.h:1176
#define UA_calloc(num, size)
Definition: open62541.h:104
uint8_t UA_Byte
Byte ^^^^ An integer value between 0 and 255.
Definition: open62541.h:938
BrowseResult ^^^^^^^^^^^^ The result of a browse operation.
Definition: open62541.h:5025
UA_DateTimeStruct UA_DateTime_toStruct(UA_DateTime t)
Definition: open62541.c:4844
void UA_Session_init(UA_Session *session)
Definition: open62541.c:15617
#define UA_STATUSCODE_BADMETHODINVALID
Definition: open62541.h:787
SecureConversationMessageHeader ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Secure Layer Sequence Header...
Definition: open62541.c:2663
#define UA_STATUSCODE_BADSENSORFAILURE
Definition: open62541.h:812
#define FLOAT_NAN
Definition: open62541.c:6163
#define UA_STATUSCODE_BADCERTIFICATEREVOCATIONUNKNOWN
Definition: open62541.h:681
void UA_SecureChannel_deleteMembersCleanup(UA_SecureChannel *channel)
Definition: open62541.c:15161
UA_String name
Definition: open62541.h:3712
#define UA_BYTE_MAX
Definition: open62541.h:940
size_t nodesToBrowseSize
Definition: open62541.h:5004
UA_String indexRange
Definition: open62541.h:3876
#define UA_STATUSCODE_BADFILTEROPERANDCOUNTMISMATCH
Definition: open62541.h:730
#define UA_NS0ID_HASNOTIFIER
Definition: open62541.h:1841
#define UA_TYPES_DELETEREFERENCESREQUEST
Definition: open62541.h:4753
UA_QualifiedName dataEncoding
Definition: open62541.h:3877
UA_Boolean namespaceZero
Definition: open62541.h:1642
#define UA_STATUSCODE_BADAGGREGATENOTSUPPORTED
Definition: open62541.h:850
UA_UInt32 maxChunkCount
Definition: open62541.c:2553
#define DAYS_PER_4Y
Definition: open62541.c:26284
VariableTypeAttributes ^^^^^^^^^^^^^^^^^^^^^^ The attributes for a variable type node.
Definition: open62541.h:4243
UA_Boolean hasInnerStatusCode
Definition: open62541.h:1593
#define UA_TYPES_NOTIFICATIONMESSAGE
Definition: open62541.h:3380
UA_String namespaceUri
Definition: open62541.h:1240
#define UA_TYPES_TIMESTAMPSTORETURN
Definition: open62541.h:3584
UA_ReferenceDescription * references
Definition: open62541.h:5029
#define UA_STATUSCODE_BADNOSUBSCRIPTION
Definition: open62541.h:791
UA_StatusCode(* getSendBuffer)(UA_Connection *connection, size_t length, UA_ByteString *buf)
Definition: open62541.h:9492
CloseSecureChannelResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^ Closes a secure channel.
Definition: open62541.h:4518
Definition: open62541.c:3879
#define UA_TYPES_SECURITYTOKENREQUESTTYPE
Definition: open62541.h:3772
UA_AddNodesResult * results
Definition: open62541.h:4494
#define UA_NS0ID_UINT32
Definition: open62541.h:1802
#define DAYS_PER_100Y
Definition: open62541.c:26283
#define PRODUCT_NAME
Definition: open62541.c:27554
#define UA_STATUSCODE_BADUNEXPECTEDERROR
Definition: open62541.h:652
UA_StatusCode status
Definition: open62541.h:1575
#define UA_TYPES_DELETESUBSCRIPTIONSREQUEST
Definition: open62541.h:3923
#define UA_STATUSCODE_BADWRITENOTSUPPORTED
Definition: open62541.h:785
#define UA_NS0ID_GUID
Definition: open62541.h:1809
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_SOFTWARECERTIFICATES
Definition: open62541.h:2657
UA_Boolean hasAdditionalInfo
Definition: open62541.h:1592
UA_ByteString clientNonce
Definition: open62541.h:5044
UA_UInt32 sizePrimeIndex
Definition: open62541.c:19165
ViewNode
Definition: open62541.c:3685
#define UA_EXPANDEDNODEID_NAMESPACEURI_FLAG
Definition: open62541.c:6450
#define UA_NS0ID_BUILDINFOTYPE
Definition: open62541.h:2646
UA_ResponseHeader responseHeader
Definition: open62541.h:4683
#define UA_STATUSCODE_BADWAITINGFORRESPONSE
Definition: open62541.h:873
UA_NODE_BASEATTRIBUTES UA_Byte eventNotifier
Definition: open62541.c:3687
UA_Boolean hasLocale
Definition: open62541.h:1591
#define UA_TYPES_ANONYMOUSIDENTITYTOKEN
Definition: open62541.h:3556
void UA_delete(void *p, const UA_DataType *type)
Definition: open62541.c:5743
UA_ServerState
ServerState ^^^^^^^^^^^.
Definition: open62541.h:4112
UA_UInt32 * availableSequenceNumbers
Definition: open62541.h:3997
#define UA_STATUSCODE_BADUNKNOWNRESPONSE
Definition: open62541.h:662
void UA_Subscription_answerPublishRequestsNoSubscription(UA_Server *server, UA_NodeId *sessionToken)
GetEndpointsRequest ^^^^^^^^^^^^^^^^^^^ Gets the endpoints used by the server.
Definition: open62541.h:4464
void Service_AddReferences(UA_Server *server, UA_Session *session, const UA_AddReferencesRequest *request, UA_AddReferencesResponse *response)
Definition: open62541.c:22296
#define UA_NS0ID_HASHISTORICALCONFIGURATION
Definition: open62541.h:1847
UA_StatusCode(* UA_copySignature)(const void *src, void *dst, const UA_DataType *type)
Definition: open62541.c:5603
void pcg32_srandom_r(pcg32_random_t *rng, uint64_t initial_state, uint64_t initseq)
Definition: open62541.c:26384
UA_ExpandedNodeId targetNodeId
Definition: open62541.h:3622
UA_Boolean hasServerPicoseconds
Definition: open62541.h:1573
#define SLIST_INIT(head)
Definition: open62541.c:158
#define UA_TYPES_RELATIVEPATHELEMENT
Definition: open62541.h:3480
UA_ExtensionObject * notificationData
Definition: open62541.h:3377
AddNodesResult ^^^^^^^^^^^^^^ A result of an add node operation.
Definition: open62541.h:3339
#define UA_TYPES_DOUBLE
Double ^^^^^^.
Definition: open62541.h:3151
#define LIST_INSERT_AFTER(listelm, elm, field)
Definition: open62541.c:236
void(* releaseRecvBuffer)(UA_Connection *connection, UA_ByteString *buf)
Definition: open62541.h:9520
UA_String securityPolicyUri
Definition: open62541.h:5073
UA_ServerNetworkLayer UA_ServerNetworkLayerTCP(UA_ConnectionConfig conf, UA_UInt16 port)
Definition: open62541.c:27249
#define UA_STATUSCODE_BADCONTENTFILTERINVALID
Definition: open62541.h:727
CreateSessionResponse ^^^^^^^^^^^^^^^^^^^^^ Creates a new session with the server.
Definition: open62541.h:5151
UA_String text
Definition: open62541.h:1315
const UA_ByteString UA_BYTESTRING_NULL
Definition: open62541.c:4773
#define UA_STATUSCODE_BADFILTEROPERATORUNSUPPORTED
Definition: open62541.h:729
#define UA_TYPES_BROWSENEXTRESPONSE
Definition: open62541.h:5119
UA_NodeClass
NodeClass ^^^^^^^^^ A mask specifying the class of the node.
Definition: open62541.h:3807
UA_StatusCode UA_SecureChannelManager_renew(UA_SecureChannelManager *cm, UA_Connection *conn, const UA_OpenSecureChannelRequest *request, UA_OpenSecureChannelResponse *response)
Definition: open62541.c:18748
UA_UInt32 remainingPathIndex
Definition: open62541.h:3254
UA_StatusCode UA_Variant_copyRange(const UA_Variant *src, UA_Variant *dst, const UA_NumericRange range)
Definition: open62541.c:5313
#define UA_TYPES_INT64
Int64 ^^^^^.
Definition: open62541.h:3133
#define UA_NS0ID_AGGREGATES
Definition: open62541.h:1837
#define UA_STATUSCODE_BADSOURCENODEIDINVALID
Definition: open62541.h:761
UA_TimestampsToReturn
TimestampsToReturn ^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3575
#define UA_NS0ID_EVENTTYPESFOLDER
Definition: open62541.h:2645
UA_StatusCode UA_Server_addRepeatedJob(UA_Server *server, UA_Job job, UA_UInt32 interval, UA_Guid *jobId)
Repeated jobs
Definition: open62541.c:18101
RegisterNodesRequest ^^^^^^^^^^^^^^^^^^^^ Registers one or more nodes for repeated use within a sessi...
Definition: open62541.h:3969
EndpointDescription ^^^^^^^^^^^^^^^^^^^ The description of a endpoint that can be used to access a se...
Definition: open62541.h:5068
#define LIST_EMPTY(head)
Definition: open62541.c:216
#define UA_BINARY_OVERLAYABLE_FLOAT
Float Endianness ^^^^^^^^^^^^^^^^ The definition UA_BINARY_OVERLAYABLE_FLOAT is true when the floatin...
Definition: open62541.h:268
UA_LocalizedText description
Definition: open62541.h:4425
ObjectAttributes ^^^^^^^^^^^^^^^^ The attributes for an object node.
Definition: open62541.h:4422
#define UA_NS0ID_SERVER_SERVICELEVEL
Definition: open62541.h:2551
#define UA_TYPES_QUERYNEXTREQUEST
Definition: open62541.h:4194
#define UA_STATUSCODE_BADTCPSERVERTOOBUSY
Definition: open62541.h:796
#define UA_TYPES_ACTIVATESESSIONRESPONSE
Definition: open62541.h:4153
#define UA_TYPES_REQUESTHEADER
Definition: open62541.h:3310
UA_DataTypeMember * members
Definition: open62541.h:1666
UA_ResponseHeader responseHeader
Definition: open62541.h:4725
#define UA_TYPES_UINT16
UInt16 ^^^^^^.
Definition: open62541.h:3115
UA_SecureChannel * channel
Definition: open62541.c:3735
UA_StatusCode UA_encodeBinary(const void *src, const UA_DataType *type, UA_exchangeEncodeBuffer exchangeCallback, void *exchangeHandle, UA_ByteString *dst, size_t *offset) UA_FUNC_ATTR_WARN_UNUSED_RESULT
Definition: open62541.c:7236
#define UA_TYPES_VARIANT
Variant ^^^^^^^.
Definition: open62541.h:3229
void UA_SecureChannelManager_cleanupTimedOut(UA_SecureChannelManager *cm, UA_DateTime nowMonotonic)
Definition: open62541.c:18670
UA_TimestampsToReturn timestampsToReturn
Definition: open62541.h:4948
DeleteReferencesResponse ^^^^^^^^^^^^^^^^^^^^^^^^ Delete one or more references from the server addre...
Definition: open62541.h:4668
#define UA_TYPES_NODECLASS
Definition: open62541.h:3821
#define LIST_INIT(head)
Definition: open62541.c:232
#define UA_STATUSCODE_GOODOVERLOAD
Definition: open62541.h:702
void(* close)(UA_Connection *connection)
Definition: open62541.h:9523
UA_UInt32 requestHandle
Definition: open62541.h:3903
#define UA_FALSE
Definition: open62541.h:924
UA_NODE_BASEATTRIBUTES UA_Boolean executable
Definition: open62541.c:3507
void UA_Variant_setArray(UA_Variant *v, void *UA_RESTRICT array, size_t arraySize, const UA_DataType *type)
Definition: open62541.c:5180
#define UA_STATUSCODE_BADVIEWTIMESTAMPINVALID
Definition: open62541.h:770
void Service_CreateSession(UA_Server *server, UA_SecureChannel *channel, const UA_CreateSessionRequest *request, UA_CreateSessionResponse *response)
Session Service Set This Service Set defines Services for an application layer connection establishme...
Definition: open62541.c:19887
#define UA_NS0ID_SERVER_SERVERCAPABILITIES_SERVERPROFILEARRAY
Definition: open62541.h:2553
size_t availableSequenceNumbersSize
Definition: open62541.h:3996
#define UA_STATUSCODE_BADIDENTITYTOKENINVALID
Definition: open62541.h:687
#define PRODUCT_URI
Definition: open62541.c:27555
#define UA_fd_set(fd, fds)
Definition: open62541.c:26725
#define UA_alloca(SIZE)
Definition: open62541.h:113
UA_String name
Definition: open62541.h:1289
#define UA_NS0ID_SERVER_SERVERCAPABILITIES
Definition: open62541.h:2552
struct UA_NotificationMessageEntry UA_NotificationMessageEntry
#define AGAIN
Definition: open62541.c:26745
#define UA_STATUSCODE_BADBROWSEDIRECTIONINVALID
Definition: open62541.h:737
#define UA_STRING_STATIC(s)
Definition: open62541.c:27559
#define TAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition: open62541.c:466
#define UA_STATUSCODE_GOODLOCALOVERRIDE
Definition: open62541.h:822
UA_Byte u8
Definition: open62541.c:773
#define SLIST_HEAD(name, type)
Definition: open62541.c:119
#define UA_TYPES_SERVERSTATE
Definition: open62541.h:4125
#define LIST_INSERT_HEAD(head, elm, field)
Definition: open62541.c:251
#define UA_TRANSPORT_SECURECONVERSATIONMESSAGEABORTBODY
Definition: open62541.c:2530
MonitoredItemCreateRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4735
void(* UA_Logger)(UA_LogLevel level, UA_LogCategory category, const char *msg, va_list args)
The signature of the logger.
Definition: open62541.h:9654
ModifyMonitoredItemsResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4759
UA_SecurityTokenRequestType
SecurityTokenRequestType ^^^^^^^^^^^^^^^^^^^^^^^^ Indicates whether a token if being created or renew...
Definition: open62541.h:3765
#define UA_NS0ID_HASEVENTSOURCE
Definition: open62541.h:1831
#define UA_NS0ID_SERVER_SERVERDIAGNOSTICS
Definition: open62541.h:2556
#define UA_STATUSCODE_BADSECURITYPOLICYREJECTED
Definition: open62541.h:745
UA_STATIC_ASSERT(sizeof(UA_MessageType)==sizeof(UA_Int32), enum_must_be_32bit)
#define UA_NS0ID_CLOSESESSIONREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2071
#define UA_STATUSCODE_BADINVALIDSTATE
Definition: open62541.h:870
size_t messageSizeSoFar
Definition: open62541.c:3227
#define UA_STATUSCODE_BADCONDITIONALREADYENABLED
Definition: open62541.h:825
#define UA_NS0ID_DIAGNOSTICINFO
Definition: open62541.h:1820
#define UA_NS0ID_SERVER_GETMONITOREDITEMS
Definition: open62541.h:2769
#define UA_STATUSCODE_BADFILTERLITERALINVALID
Definition: open62541.h:733
#define UA_STATUSCODE_BADARGUMENTSMISSING
Definition: open62541.h:788
#define UA_STATUSCODE_UNCERTAINSUBSTITUTEVALUE
Definition: open62541.h:817
UA_Double maxAge
Definition: open62541.h:4801
#define UA_STATUSCODE_BADNODATAAVAILABLE
Definition: open62541.h:872
#define UA_STATUSCODE_UNCERTAINDEPENDENTVALUECHANGED
Definition: open62541.h:860
UA_StatusCode Service_AddNodes_existing(UA_Server *server, UA_Session *session, UA_Node *node, const UA_NodeId *parentNodeId, const UA_NodeId *referenceTypeId, const UA_NodeId *typeDefinition, UA_InstantiationCallback *instantiationCallback, UA_NodeId *addedNodeId)
Definition: open62541.c:21654
UA_NodeId referenceTypeId
Definition: open62541.h:4440
UA_UInt32 * arrayDimensions
Definition: open62541.h:3360
#define UA_TYPES_OBJECTTYPEATTRIBUTES
Definition: open62541.h:3745
UA_StatusCode UA_Array_copy(const void *src, size_t size, void **dst, const UA_DataType *type)
Definition: open62541.c:5760
#define UA_STATUSCODE_BADATTRIBUTEIDINVALID
Definition: open62541.h:708
UA_Double samplingInterval
Definition: open62541.h:3676
UA_MonitoringMode monitoringMode
Definition: open62541.h:4389
#define UA_THREAD_LOCAL
Definition: open62541.c:766
#define UA_TYPES_CREATESESSIONREQUEST
Definition: open62541.h:5050
ContentFilterElementResult ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3525
#define UA_TYPES_BROWSEPATHTARGET
Definition: open62541.h:3257
UA_UInt32 attributeId
Definition: open62541.h:3634
#define UA_TYPES_NODETYPEDESCRIPTION
Definition: open62541.h:5105
#define UA_DATETIME_UNIX_EPOCH
Definition: open62541.h:1078
UA_UInt32 messageTypeAndChunkType
Definition: open62541.c:2629
#define UA_STATUSCODE_BADINVALIDTIMESTAMP
Definition: open62541.h:690
#define LIST_FOREACH(var, head, field)
Definition: open62541.c:219
void Service_Write(UA_Server *server, UA_Session *session, const UA_WriteRequest *request, UA_WriteResponse *response)
Definition: open62541.c:21136
#define UA_TYPES_OBJECTATTRIBUTES
Definition: open62541.h:4431
BrowseDescription ^^^^^^^^^^^^^^^^^ A request to browse the the references from a node...
Definition: open62541.h:4437
#define UA_NS0ID_BASEVARIABLETYPE
Definition: open62541.h:1850
#define UA_NodeStore_newMethodNode()
Definition: open62541.c:3991
#define UA_STATUSCODE_BADCERTIFICATEURIINVALID
Definition: open62541.h:677
#define UA_NS0ID_MODELLINGRULETYPE
Definition: open62541.h:1857
#define UA_STATUSCODE_BADTCPSECURECHANNELUNKNOWN
Definition: open62541.h:798
#define UA_NS0ID_SERVERSTATUSTYPE
Definition: open62541.h:2527
UA_StatusCode UA_Client_deleteNode(UA_Client *client, const UA_NodeId nodeId, UA_Boolean deleteTargetReferences)
Definition: open62541.c:25632
#define UA_NS0ID_READREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2229
#define UA_NS0ID_EXPANDEDNODEID
Definition: open62541.h:1813
struct session_list_entry session_list_entry
#define UA_RESTRICT
Non-aliasing pointers
Definition: open62541.h:163
#define UA_STATUSCODE_BADFILTEROPERATORINVALID
Definition: open62541.h:728
#define UA_TYPES_QUERYDATADESCRIPTION
Definition: open62541.h:5062
void Service_ModifyMonitoredItems(UA_Server *server, UA_Session *session, const UA_ModifyMonitoredItemsRequest *request, UA_ModifyMonitoredItemsResponse *response)
int __secs_to_tm(long long t, struct tm *tm)
Definition: open62541.c:26286
#define UA_NS0ID_BYTE
Definition: open62541.h:1798
UA_StatusCode UA_Client_deleteReference(UA_Client *client, const UA_NodeId sourceNodeId, const UA_NodeId referenceTypeId, UA_Boolean isForward, const UA_ExpandedNodeId targetNodeId, UA_Boolean deleteBidirectional)
Definition: open62541.c:25601
#define UA_STATUSCODE_BADCONFIGURATIONERROR
Definition: open62541.h:809
#define UA_STATUSCODE_BADTOOMANYMONITOREDITEMS
Definition: open62541.h:670
status(* UA_encodeBinarySignature)(const void *UA_RESTRICT src, const UA_DataType *type)
Definition: open62541.c:5855
void Service_RegisterNodes(UA_Server *server, UA_Session *session, const UA_RegisterNodesRequest *request, UA_RegisterNodesResponse *response)
Definition: open62541.c:23261
UA_UInt16 binaryEncodingId
Definition: open62541.h:1664
size_t arrayDimensionsSize
Definition: open62541.h:1404
UA_Boolean userExecutable
Definition: open62541.c:3508
UA_SubscriptionAcknowledgement * subscriptionAcknowledgements
Definition: open62541.h:4482
void Service_Republish(UA_Server *server, UA_Session *session, const UA_RepublishRequest *request, UA_RepublishResponse *response)
UA_String targetServerUri
Definition: open62541.h:4618
UA_Int32 localizedText
Definition: open62541.h:1597
UA_BrowseResult * results
Definition: open62541.h:5140
#define UA_NS0ID_MODELLINGRULE_OPTIONAL
Definition: open62541.h:1860
UA_TimestampsToReturn timestampsToReturn
Definition: open62541.h:4802
#define UA_NS0ID_HASCHILD
Definition: open62541.h:1829
union UA_NodeId::@0 identifier
#define UA_NS0ID_OBJECTTYPESFOLDER
Definition: open62541.h:1866
#define UA_TYPES_DATETIME
DateTime ^^^^^^^^.
Definition: open62541.h:3163
UA_ReadValueId itemToMonitor
Definition: open62541.h:4736
UA_ResponseHeader responseHeader
Definition: open62541.h:4774
UA_Client * UA_Client_new(UA_ClientConfig config)
Definition: open62541.c:24666
#define UA_STATUSCODE_BADDATATYPEIDUNKNOWN
Definition: open62541.h:671
UA_UsernamePasswordLogin usernamePasswords[2]
Definition: open62541.c:27566
#define UA_NS0ID_REPUBLISHREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2424
#define UA_TYPES_SETPUBLISHINGMODERESPONSE
Definition: open62541.h:4595
#define UA_TYPES_MONITORINGMODE
Definition: open62541.h:3437
#define UA_TYPES_REFERENCEDESCRIPTION
Definition: open62541.h:4581
#define UA_TYPES_ADDREFERENCESREQUEST
Definition: open62541.h:4793
UA_DataChangeTrigger
DataChangeTrigger ^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3778
UA_MonitoredItemType
Definition: open62541.c:3828
#define UA_TYPES_VARIABLETYPEATTRIBUTES
Definition: open62541.h:4257
QueryFirstResponse ^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4970
#define UA_TYPES_APPLICATIONDESCRIPTION
Definition: open62541.h:4917
UA_ReadValueId * nodesToRead
Definition: open62541.h:4804
UA_MonitoringMode monitoringMode
Definition: open62541.h:4737
struct UA_SessionManager UA_SessionManager
UA_ExpandedNodeId targetId
Definition: open62541.h:3253
RepublishRequest ^^^^^^^^^^^^^^^^.
Definition: open62541.h:4452
#define UA_STATUSCODE_BADTCPNOTENOUGHRESOURCES
Definition: open62541.h:800
UA_StatusCode statusCode
Definition: open62541.h:4264
#define UA_TYPES_USERTOKENPOLICY
Definition: open62541.h:4350
UA_NotificationMessage notificationMessage
Definition: open62541.h:4726
#define UA_NS0ID_NUMBER
Definition: open62541.h:1821
#define UA_STATUSCODE_UNCERTAINENGINEERINGUNITSEXCEEDED
Definition: open62541.h:820
enum UA_Job::@4 type
#define UA_STATUSCODE_BADFILTERNOTALLOWED
Definition: open62541.h:724
UA_RequestHeader requestHeader
Definition: open62541.h:4068
DataChangeNotification ^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4505
const char * LogCategoryNames[6]
Definition: open62541.c:27501
UA_UInt32 sendSequenceNumber
Definition: open62541.c:3241
const UA_DataType UA_TYPES[UA_TYPES_COUNT]
Definition: open62541.c:12120
UA_BuildInfo buildInfo
Definition: open62541.h:4833
UA_UInt32 sequenceNumber
Definition: open62541.c:2618
#define UA_TYPES_XMLELEMENT
XmlElement ^^^^^^^^^^.
Definition: open62541.h:3181
UA_NodeId * nodesToRegister
Definition: open62541.h:3972
#define UA_TRUE
Definition: open62541.h:923
#define UA_STRING_ALLOC(CHARS)
Definition: open62541.h:1060
#define UA_TYPES_DIAGNOSTICINFO
DiagnosticInfo ^^^^^^^^^^^^^^.
Definition: open62541.h:3235
#define UA_TYPES_CREATEMONITOREDITEMSREQUEST
Definition: open62541.h:4953
#define UA_TYPES_DELETEMONITOREDITEMSRESPONSE
Definition: open62541.h:3949
#define UA_STATUSCODE_BADWAITINGFORINITIALDATA
Definition: open62541.h:705
void Service_Browse_single(UA_Server *server, UA_Session *session, struct ContinuationPointEntry *cp, const UA_BrowseDescription *descr, UA_UInt32 maxrefs, UA_BrowseResult *result)
Definition: open62541.c:22703
UA_UInt32 numeric
Definition: open62541.h:1175
#define UA_EMPTY_ARRAY_SENTINEL
Definition: open62541.h:1389
PublishResponse ^^^^^^^^^^^^^^^.
Definition: open62541.h:3993
UA_RelativePath relativePath
Definition: open62541.h:5016
UA_StatusCode __UA_Client_readAttribute(UA_Client *client, const UA_NodeId *nodeId, UA_AttributeId attributeId, void *out, const UA_DataType *outDataType)
Definition: open62541.c:25825
#define UA_TYPES_CREATEMONITOREDITEMSRESPONSE
Definition: open62541.h:4690
UA_NodeId * registeredNodeIds
Definition: open62541.h:4306
UA_UserTokenType
UserTokenType ^^^^^^^^^^^^^ The possible user token types.
Definition: open62541.h:4051
UA_ConnectionState state
Definition: open62541.h:9479
UA_StatusCode UA_copy(const void *src, void *dst, const UA_DataType *type)
Definition: open62541.c:5671
UA_UInt32 serverIndex
Definition: open62541.h:1241
UA_LocalizedText displayName
Definition: open62541.h:3604
UA_String endpointUrl
Definition: open62541.c:4729
UA_StatusCode UA_Server_delayedCallback(UA_Server *server, UA_ServerCallback callback, void *data)
Definition: open62541.c:18285
#define UA_malloc(_p_size)
UA_Variant * outputArguments
Definition: open62541.h:3450
void UA_deleteMembers(void *p, const UA_DataType *type)
Definition: open62541.c:5737
#define UA_STATUSCODE_BADTYPEDEFINITIONINVALID
Definition: open62541.h:760
UA_UserTokenPolicy * userIdentityTokens
Definition: open62541.h:5075
#define UA_STATUSCODE_BADNODATA
Definition: open62541.h:836
BrowseRequest ^^^^^^^^^^^^^ Browse the references for one or more nodes from the server address space...
Definition: open62541.h:5000
UA_StatusCode UA_Connection_receiveChunksBlocking(UA_Connection *connection, UA_ByteString *chunks, UA_Boolean *realloced, UA_UInt32 timeout)
Definition: open62541.c:14968
#define UA_STATUSCODE_UNCERTAINNOCOMMUNICATIONLASTUSABLEVALUE
Definition: open62541.h:815
UA_StatusCode UA_Server_write(UA_Server *server, const UA_WriteValue *value)
The following node attributes cannot be changed once a node has been created:
Definition: open62541.c:21159
#define UA_STATUSCODE_BADFILTEROPERANDINVALID
Definition: open62541.h:731
#define UA_TRANSPORT_TCPMESSAGEHEADER
Definition: open62541.c:2633
#define UA_MAXCONTINUATIONPOINTS
Definition: open62541.c:3704
NodeTypeDescription ^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:5098
struct UA_DiagnosticInfo UA_DiagnosticInfo
DiagnosticInfo ^^^^^^^^^^^^^^ A structure that contains detailed error and diagnostic information ass...
#define UA_TYPES_REGISTERNODESRESPONSE
Definition: open62541.h:4309
#define UA_TYPES_DELETENODESREQUEST
Definition: open62541.h:3987
#define UA_FUNC_ATTR_WARN_UNUSED_RESULT
Definition: open62541.h:178
#define MAX_PROFILEARRAY
UA_Double requestedSessionTimeout
Definition: open62541.h:5046
#define UA_TYPES_CALLRESPONSE
Definition: open62541.h:4704
#define UA_STATUSCODE_BADHISTORYOPERATIONUNSUPPORTED
Definition: open62541.h:783
#define UA_STATUSCODE_BADAPPLICATIONSIGNATUREINVALID
Definition: open62541.h:748
#define TAILQ_INSERT_TAIL(head, elm, field)
Definition: open62541.c:502
BrowsePathResult ^^^^^^^^^^^^^^^^ The result of a translate opearation.
Definition: open62541.h:4263
#define UA_BUILTIN_TYPES_COUNT
Definition: open62541.h:916
#define UA_STATUSCODE_BADREQUESTTOOLARGE
Definition: open62541.h:660
struct pcg_state_setseq_64 pcg32_random_t
#define UA_TYPES_ENDPOINTDESCRIPTION
Definition: open62541.h:5080
OpenSecureChannelRequest ^^^^^^^^^^^^^^^^^^^^^^^^ Creates a secure channel with a server...
Definition: open62541.h:4288
#define UA_OPEN62541_VER_PATCH
Definition: open62541.h:41
#define UA_TYPES_NODEATTRIBUTESMASK
Definition: open62541.h:3423
#define UA_NS0ID_FOLDERTYPE
Definition: open62541.h:1849
#define UA_STATUSCODE_BADNOTWRITABLE
Definition: open62541.h:714
UA_NODE_BASEATTRIBUTES UA_Boolean isAbstract
Definition: open62541.c:3542
UA_Double minimumSamplingInterval
Definition: open62541.c:3465
UA_BrowseResult * results
Definition: open62541.h:5114
AddReferencesRequest ^^^^^^^^^^^^^^^^^^^^ Adds one or more references to the server address space...
Definition: open62541.h:4787
UA_NodeStore * nodestore
Definition: open62541.c:4211
#define UA_TYPES_QUERYFIRSTRESPONSE
Definition: open62541.h:4982
#define UA_STATUSCODE_BADREQUESTNOTALLOWED
Definition: open62541.h:854
UA_ByteString password
Definition: open62541.h:4026
#define UA_STATUSCODE_BADDECODINGERROR
Definition: open62541.h:658
#define UA_MSEC_TO_DATETIME
Definition: open62541.h:1074
void UA_SecureChannel_attachSession(UA_SecureChannel *channel, UA_Session *session)
Definition: open62541.c:15208
#define UA_STATUSCODE_BADMAXAGEINVALID
Definition: open62541.h:780
#define STARTCHANNELID
Definition: open62541.c:18621
UA_RequestHeader requestHeader
Definition: open62541.h:3330
uint32_t UA_StatusCode
Definition: open62541.h:1011
#define UA_TYPES_CONTENTFILTERELEMENT
Definition: open62541.h:4890
#define TAILQ_HEAD(name, type)
Definition: open62541.c:432
#define UA_STATUSCODE_BADNOENTRYEXISTS
Definition: open62541.h:842
UA_MessageType
MessageType ^^^^^^^^^^^ Message Type and whether the message contains an intermediate chunk...
Definition: open62541.c:2574
#define UA_STATUSCODE_BADCERTIFICATEUSENOTALLOWED
Definition: open62541.h:678
UA_Boolean moreNotifications
Definition: open62541.h:3998
#define UA_STATUSCODE_BADMONITORINGMODEINVALID
Definition: open62541.h:720
UA_UInt32 maxChunkCount
Definition: open62541.h:9454
#define FLOAT_INF
Definition: open62541.c:6164
#define UA_TYPES_SETMONITORINGMODEREQUEST
Definition: open62541.h:4394
UA_UInt32 nodeClassMask
Definition: open62541.h:4442
#define UA_TYPES_NODEID
NodeId ^^^^^^.
Definition: open62541.h:3187
UA_StatusCode UA_ByteString_allocBuffer(UA_ByteString *bs, size_t length)
Definition: open62541.c:4932
size_t endpointDescriptionsSize
Definition: open62541.c:4203
UA_StatusCode * results
Definition: open62541.h:4847
ModifySubscriptionResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4275
UA_Boolean historizing
Definition: open62541.h:3364
size_t dimensionsSize
Definition: open62541.h:1347
UnregisterNodesResponse ^^^^^^^^^^^^^^^^^^^^^^^ Unregisters one or more previously registered nodes...
Definition: open62541.h:4400
struct UA_Job::@5::@7 methodCall
UA_ViewDescription view
Definition: open62541.h:5002
PublishRequest ^^^^^^^^^^^^^^.
Definition: open62541.h:4479
#define UA_NS0ID_SERVER_NAMESPACEARRAY
Definition: open62541.h:2539
#define UA_NS0ID_SERVER_GETMONITOREDITEMS_INPUTARGUMENTS
Definition: open62541.h:2770
UA_Boolean builtin
Definition: open62541.h:1658
UA_Int32 namespaceUri
Definition: open62541.h:1596
UA_AsymmetricAlgorithmSecurityHeader serverAsymAlgSettings
Definition: open62541.c:3237
MonitoredItemModifyRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4012
#define UA_STATUSCODE_BADDOMINANTVALUECHANGED
Definition: open62541.h:859
#define SIMPLEQ_INSERT_TAIL(head, elm, field)
Definition: open62541.c:326
UA_UInt32 timeoutHint
Definition: open62541.h:3306
#define UA_STATUSCODE_BADEVENTIDUNKNOWN
Definition: open62541.h:827
int64_t UA_Int64
Int64 ^^^^^ An integer value between -9 223 372 036 854 775 808 and 9 223 372 036 854 775 807...
Definition: open62541.h:979
#define UA_TYPES_CREATESUBSCRIPTIONRESPONSE
Definition: open62541.h:4637
#define UA_STATUSCODE_BADNODEIDREJECTED
Definition: open62541.h:754
#define UA_TYPES_EXPANDEDNODEID
ExpandedNodeId ^^^^^^^^^^^^^^.
Definition: open62541.h:3193
UA_ResponseHeader responseHeader
Definition: open62541.h:4276
CreateMonitoredItemsResponse ^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4682
#define UA_TYPES_CONTENTFILTERRESULT
Definition: open62541.h:4608
#define UA_TYPES_DATATYPEATTRIBUTES
Definition: open62541.h:3895
void Service_BrowseNext(UA_Server *server, UA_Session *session, const UA_BrowseNextRequest *request, UA_BrowseNextResponse *response)
Definition: open62541.c:22905
UA_NodeId referenceTypeId
Definition: open62541.h:4616
#define LIST_REMOVE(elm, field)
Definition: open62541.c:258
#define UA_TYPES_BROWSERESULTMASK
Definition: open62541.h:3294
#define UA_STATUSCODE_BADAGGREGATEINVALIDINPUTS
Definition: open62541.h:851
#define UA_TRANSPORT_TCPERRORMESSAGE
Definition: open62541.c:2568
void Service_SetPublishingMode(UA_Server *server, UA_Session *session, const UA_SetPublishingModeRequest *request, UA_SetPublishingModeResponse *response)
#define UA_TYPES_ADDNODESRESULT
Definition: open62541.h:3344
#define UA_PRINTF_STRING_FORMAT
Definition: open62541.h:9731
MonitoredItemNotification ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:3840
#define UA_STATUSCODE_BADNODEIDINVALID
Definition: open62541.h:706
BrowsePathTarget ^^^^^^^^^^^^^^^^ The target of the translated path.
Definition: open62541.h:3252
size_t nodesToReadSize
Definition: open62541.h:4803
const UA_VariableTypeNode * getVariableNodeType(UA_Server *server, const UA_VariableNode *node)
Definition: open62541.c:17852
#define UA_NS0ID_SERVERSTATE
Definition: open62541.h:2444
ModifySubscriptionRequest ^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4326
#define UA_STATUSCODE_BADCONDITIONBRANCHALREADYCONFIRMED
Definition: open62541.h:832
ModifyMonitoredItemsRequest ^^^^^^^^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4528
void UA_Connection_detachSecureChannel(UA_Connection *connection)
Definition: open62541.c:14995
UA_UInt32 recvBufferSize
Definition: open62541.h:9452
size_t resultsSize
Definition: open62541.h:4698
#define UA_STATUSCODE_BADSHUTDOWN
Definition: open62541.h:665
#define CHECK_ATTRIBUTES(TYPE)
Definition: open62541.c:21911
UA_LocalizedText description
Definition: open62541.h:3958
UA_StatusCode errorCode
Definition: open62541.c:3229
AnonymousIdentityToken ^^^^^^^^^^^^^^^^^^^^^^ A token representing an anonymous user.
Definition: open62541.h:3552
#define UA_TYPES_OPENSECURECHANNELRESPONSE
Definition: open62541.h:4091
UA_StatusCode(* UA_EditNodeCallback)(UA_Server *, UA_Session *, UA_Node *, const void *)
Definition: open62541.c:4248
#define LIST_ENTRY(type)
Definition: open62541.c:205
UA_StatusCode UA_SessionManager_init(UA_SessionManager *sm, UA_Server *server)
Definition: open62541.c:18812
UA_String policyId
Definition: open62541.h:4343
#define UA_STATUSCODE_BADCONDITIONALREADYSHELVED
Definition: open62541.h:833
#define UA_NODE_BASEATTRIBUTES
Definition: open62541.c:3356
#define UA_NS0ID_CALLREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2310
#define UA_TRANSPORT_COUNT
Every type is assigned an index in an array containing the type descriptions.
Definition: open62541.c:2518
LocalizedText ^^^^^^^^^^^^^ Human readable text with an optional locale identifier.
Definition: open62541.h:1313
UA_Boolean hasSourceTimestamp
Definition: open62541.h:1570
#define UA_STATUSCODE_BADTCPMESSAGETYPEINVALID
Definition: open62541.h:797
#define UA_TYPES_BUILDINFO
Definition: open62541.h:3801
#define UA_TYPES_GETENDPOINTSRESPONSE
Definition: open62541.h:5092
CallRequest ^^^^^^^^^^^.
Definition: open62541.h:3590
UA_ChannelSecurityToken nextSecurityToken
Definition: open62541.c:3235
#define UA_STATUSCODE_UNCERTAINLASTUSABLEVALUE
Definition: open62541.h:816
#define LIST_FIRST(head)
Definition: open62541.c:214
void UA_MoniteredItem_SampleCallback(UA_Server *server, UA_MonitoredItem *monitoredItem)
UA_RequestHeader requestHeader
Definition: open62541.h:4289
ContentFilterElement ^^^^^^^^^^^^^^^^^^^^.
Definition: open62541.h:4884
union UA_Job::@5 job
#define UA_TRANSPORT_SEQUENCEHEADER
Definition: open62541.c:2622
#define UA_STATUSCODE_BADCERTIFICATEISSUERUSENOTALLOWED
Definition: open62541.h:679
#define UA_STATUSCODE_BADENDOFSTREAM
Definition: open62541.h:871
UA_StatusCode UA_Server_removeRepeatedJob(UA_Server *server, UA_Guid jobId)
Definition: open62541.c:18238
#define UA_TYPES_QUALIFIEDNAME
QualifiedName ^^^^^^^^^^^^^.
Definition: open62541.h:3205
UA_LocalizedText displayName
Definition: open62541.h:4424
#define UA_TYPES_IDTYPE
Definition: open62541.h:4045
#define UA_NS0ID_BROWSEREQUEST_ENCODING_DEFAULTBINARY
Definition: open62541.h:2125